Questions tagged [node.js]
Node.js is an event-based, asynchronous I/O framework that uses Google's V8 JavaScript engine.
511 questions
3
votes
1
answer
350
views
How to name two functions that could be named the same?
I have a node app with a queue for processing jobs in the background. I have a file that exports a function which when run, creates a job in my queue. In that file, I also have the handler for this ...
-2
votes
1
answer
591
views
PHP or NodeJS for a chat app with message queue
In my company I proposed NodeJS for developing a microservice that acts as a bridge between the front-end and a third party chat API, that Microservice will receive large amounts of messages (about ...
0
votes
1
answer
254
views
Performant way for archiving image files in NodeJS on each user requests
Scenario:
Images are uploaded to the server once in a while. Users send an API request for downloading all of those images that were uploaded to the server (Images reside in the server itself). ...
0
votes
2
answers
2k
views
Deploy a NodeJs (FrontEnd) and a Spring (BackEnd) project as one artefact
I have a current project which consist out of two independently developed projects:
Spring REST as back end
Angular as front end
I do have a Jenkins instance available for building my projects and I'd ...
1
vote
1
answer
748
views
Handling Pausable Streams with RxJS
Reading a Node Stream I want to be able to receive a stream of text, and trigger the continuation of my stream.
The following code solves my purposes but I recently read that we are using Subject too ...
7
votes
1
answer
2k
views
Nodejs cluster: are there any downsides?
I was reading a litte about clusters in nodejs, and in all cases it was trivial to clusterize the application. In fact, it was so easy that I began to wonder: are there any cases that I shoudn't use ...
2
votes
0
answers
230
views
How to decouple a message broker and its message handlers?
Project description:
I have a nodejs project where I try to build a bluetooth mesh like network,
each node consists roughly of 4 parts the frontend part, the message broker, a bluetooth client and a ...
10
votes
1
answer
6k
views
Split overlapping ranges into all unique ranges
I am trying to split a dynamic number of ranges with associated attributes, so that whenever 2 or more ranges overlap, the overlapping section(s) are split into unique ranges with the combination of ...
1
vote
0
answers
179
views
Exporting functions usable by both client-side and server-side
So this isn't a question on how to do it, but more of a clarification on how it works. I'm using Vue and I'm creating a file that's usable by on both the client side and the server side (logic should ...
0
votes
1
answer
1k
views
An elegant way to detect the end of an asynchronous recursive file search?
Given a recursive subroutine in single threaded environment which starts numerous asynchronous I/O operations and registers callback functions for each of them. This callbacks will be called on the ...
0
votes
1
answer
118
views
What types of operations should go into Node.js as opposed to client side javascript functions
I am building a web app with a lot of different API calls: our own proprietary REST API, third-party library API calls, etc. All of these calls either retrieve data, update data, delete data, or ...
2
votes
2
answers
553
views
creating nodejs apps in php/mysql framework with later on full step by step migration to nodejs in mind
I'm looking for the most efficient path to convert over time my own made php framework for nodejs and I believe that nodejs experts and specific developers who had their years working with apache/php/...
5
votes
2
answers
16k
views
What is the point of rooms in socket.io?
I was wondering what the purpose of rooms is. See: https://socket.io/docs/rooms-and-namespaces/
You can basically mimic join and leave with just socket.on and socket.off
Take for example:
(no room)
...
1
vote
0
answers
63
views
Node JS Tape Unit Testing : All cases inside one function for a method
I am using tape for unit testing in Node JS. I wanted to ask one thing about better coding while writing unit testing.
When using different inputs to a single method, is it a better idea to use all ...
0
votes
1
answer
159
views
requiring files in nodejs - individual files or group?
When working in NodeJS and requiring custom modules. Is it best practice to require one file that itself requires dependencies, or is it best to explicitly require only the files that are needed?
An ...
-1
votes
1
answer
79
views
node server structure and technologies - support continuous and high volume (amount, not size) data transfare
I'm having trouble planning the structure of my server side workflow and the technologies I should use.
The basic structure and tasks are:
Now, things to consider:
1.the server listens to multiple "...
0
votes
1
answer
436
views
Micro service architecture : Solving complex queries owned by particular service
I am working micro service architecture and figuring out what is the best way to get complex data from a micro service.
So for example : Let's say micro service A is owning data based on any CRUD ...
2
votes
2
answers
297
views
Matching 2 sets of items by price
I'm trying to solve the following problem in the most efficient way I can find.
I want to trade my items for someone elses items, every item have a price and a value.
I want to maximize the value of ...
2
votes
1
answer
2k
views
How to handle UI updates dependent on slow API responses
A side project I'm working on with some friends currently deals with an API interface that, for many reasons, is slow and cannot be changed to improve speed. I'm talking API responses that take ...
1
vote
1
answer
326
views
Split requests between different server applications
I currently have a web server running apache with multiple sites on it using virtual hosts. I want to add a service to my server that is using nodejs but I want it to be accessible under the same ...
4
votes
1
answer
4k
views
Node.js script const variables in SCREAMING_SNAKE_CASE or camelCase
TL/DR: When requiring another script in Node.js and defining it as a const should the variable name still be in camelCase like it was usual with var or should it instead be in SCREAMING_SNAKE_CASE as ...
2
votes
1
answer
552
views
Where should I do integration tests in a multi package project
Background:
I am working on a node project which consists of a core package and several addon packages. For the end product to work, the core package and atleast one of the addon packages should be ...
0
votes
1
answer
264
views
How to serve a computationally intensive application via REST? [closed]
I have got a native image processing application that can enhance photos(peApp). Now, I want to serve this functionality to the world by having a server application that supports REST. Now while ...
0
votes
1
answer
503
views
Best practice to send data to webhooks without multiple redirects
I’m building a payment system for some ebooks with Reactjs on the frontend, Firebase as hosting and database and cloud functions at the backend side. Customers don’t need an account to buy ebooks so ...
0
votes
1
answer
579
views
maintaining indexing on json files
I have a directory which has approx. 100k JSON files.
I want to retrieve a list of file names, where the file satisfies a set of conditions, with a filter condition in same format as we can pass the ...
0
votes
2
answers
130
views
What is the principle that the npm module drydock can provide data at the port when the local web server is already using that port?
When a local web server is already running at port 3000, I wonder why the npm module drydock is able to provide data also through port 3000? I thought once a port is used, then other process cannot ...
0
votes
1
answer
136
views
architecture - relation of scraper and orm classes
Consider the following application structure.
The scraper class extracts the necessary information from a page, and I want to save it to the DB.
The ORM class is a wrapper around sequelize.js. It ...
3
votes
2
answers
1k
views
REST API with files as resources?
I'm storing files as REST API resources, sending and receiving them as base64 strings, along with some other metadata. What's the best way to handle GET for the collection? (e.g GET .../api/files)
...
1
vote
1
answer
1k
views
Deployment process for deploying nodejs application to production using webpack
I'm trying to work out what the correct process for deploying a nodejs application to a production environment should me, using webpack.
If this was a standard Java/Maven project I might do ...
2
votes
4
answers
774
views
Should exceptions not be thrown in Node.js?
I just started working on a new project and no one throws exceptions over here. I get that you shouldn't be doing that for asynchronous code, but it seems to be a valid way to do things for the ...
1
vote
1
answer
2k
views
Implement a HTTP server on top of NodeJS TCP APIs for learning purposes
I am very interested to learn the HTTP protocol in depth as well as understand the working of NodeJS streams up-close. I figured out that the best way to do this would be to develop an HTTP server in ...
-4
votes
1
answer
3k
views
How does the typescript transpile function work
Assume the following:
/// file.ts
var x = "hello";
x = 1;
console.log(x);
/// file.ts
function transpile(fileName) {
...
}
What steps would typescript take to transpile the file?
How and when ...
0
votes
1
answer
440
views
Should I use mongoose / mongodb to handle my user REST session in nodejs? [closed]
I'm working on a project which has the following development strategy:
Frontend: Angularjs
Backend: NodeJs
DB: Mysql
I'm bulding a REST system with nodejs and I was wondering how should I handle the ...
0
votes
2
answers
86
views
Getting an existing resource in an OOP server API
Background
I've designed and implemented a server app - a stateless REST API that mostly deals with customer CRUD operations.
As it is now the server is designed to use modules for each ...
1
vote
2
answers
1k
views
What risks are there to using Node.js with Java EE?
We are developing a B2B web application in which we are using(suggested by seniors) two servers. One is Node.js (to serve all the request related html & static content) and the other is Tomcat to ...
6
votes
1
answer
4k
views
Microservices Architecture separating backend and front end
We are trying to move (slowly) into Microservices architecture from our current monolithic based architecture. I've done my research on microservices architecture and would like to get some feedback ...
16
votes
4
answers
50k
views
Is it bad design to internally call API endpoints from within the API instance?
For context, I am running a REST API built with Node.js. Because of callbacks and some complex DB calls, I have a chain of functions that are async but also unique, so it's tough to reduce redundancy. ...
1
vote
0
answers
260
views
Best practice to maintain 2 servers - PHP and NodeJs
We have a Symfony backend server for our Android and iOS application. Recently we need to extend our application by supporting real time interaction such as chatting, and we decided to use NodeJs with ...
4
votes
2
answers
2k
views
Realtime frontend dashboard, calling api every 3 seconds, reduce cpu loads
I am working on a networking project. Where I am creating a dashboard to view real time status (CPU/memory usage, up/down traffic and few others) of multiple routers by calling API request to server ...
1
vote
0
answers
61
views
Am I using the right frameworks effectively?
I am working on a large scale application that has both a web portal and a mobile application so therefore I need to develop an API..
I have decided to go with the following structure:-
Sailsjs (this ...
1
vote
1
answer
961
views
Is this Big Data architecture good enough to handle many requests per second?
I want to ask for a review of my big data app plan. I haven’t much experience in that field, so every single piece of advice would be appreciated.
Here is a link to a diagram of the architecture: My ...
-1
votes
1
answer
345
views
I'm building an app with Node, Express, and MongoDB. Is AngularJS necessary?
Node, Express, and MongoDB are really connected so I can understand why they are frequently used together. For a web app of medium complexity, can I get away with only using HTML/CSS and EJS for the ...
5
votes
2
answers
251
views
Tracking state changes based on duration of time in state
I've been building a monitoring system that checks whether a device is alarmed or not, and if so, sends notifications to relevant users based on how long a device is in a particular state. Here's an ...
1
vote
0
answers
943
views
IPC with Node.js server
I built a post processor for creating CNC machine files to which I'd like to provide a web interface.
Currently the program takes a file path as input and then spits out the results into another file....
0
votes
1
answer
55
views
Creating a better translation for a node.js api to ruby
My client has a nodejs SDK that fetches entries using a client that makes http requests. Their api looks like this:
var Query = Client.ContentType('blog').Query();
Query
.where("title", ...
2
votes
0
answers
572
views
Designing large nanoservice architecture with AWS Lambdas
I'm moving from a coupled architecture to a decoupled architecture using microservices with AWS Lambda.
Here is my current architecture:
Each API Gateway route is linked to a specific Lambda, each ...
3
votes
3
answers
7k
views
Designing a Feed and Notification system in MongoDB
I'm developing a NodeJS API that will be consumed, for now, by an Android app.
I need 2 important things here: a News Feed and a Notification system. And I need it to be scalable.
I'm using ...
1
vote
0
answers
1k
views
It is possible to use a LGPL module on a Electron app licensed as Apache 2.0? [closed]
I'm developing a desktop app (using Node.js and Electron), licensing the code under Apache License v2.0
It's possible to add a module, licensed as Lesser GPL v3, to my app?
I know that compiled ...
3
votes
2
answers
3k
views
What's a good way to deprecate your NPM modules?
One of my NPM modules is, frankly, pretty lame, hasn't been worked on in years, has no watchers, no stars, and only ~50 downloads per month. I'm going to abandon it, and eventually delete it so it ...
1
vote
1
answer
295
views
Howto structure my app.js code to make it easier testable
I have a couple of Philip Hue lights in the hallway. These show the build status on their lights with a small Node.JS application. Its working like a charm.
Currently I am in the process of testing ...