Questions tagged [node.js]
Node.js is an event-based, asynchronous I/O framework that uses Google's V8 JavaScript engine.
511 questions
-2
votes
1
answer
58
views
Do I need a separate backend (Express) for an Angular project if using AWS for data storage?
So, I'm working on developing my first Angular project with/for a friend of mine and I have a design question before I really get started with things.
I'm going to be storing persistent data on AWS ...
1
vote
1
answer
3k
views
Rabbitmq create queues dynamically based on number of users
I have a scenario where I have to route a list of messages that I get to respective users.
For suppose if I have
messages = [
{ text: 'hi', user_id: 1 },
{ text: 'hi', user_id: 2 },
{ text: 'hi',...
0
votes
1
answer
354
views
TCP connection-oriented synchronous data write
thinking about the design of an IoT project where the devices don't have a standard application layer but rather a thin custom application layer utilizing TCP sockets. What I mean by this is that the ...
-2
votes
1
answer
125
views
How to warn devs after installing or updating npm packages? [closed]
I want to warn devs in my team to rebuild the docker containers after installing or updating npm packages.
This is because whenever we edit packages in the environment the only way we've found to test ...
3
votes
3
answers
691
views
Is checking dependencies into source control worth the cost?
For the last several years, I've been checking all dependencies of my team's nodejs project into source control. At first, we stored the archives of all dependencies using yarn v1's offline mirror, ...
-2
votes
2
answers
1k
views
How to best manage multilingual information in documents in JSON/MongoDB/Mongoose?
I have to manage multilingual information in JSON documents in a MongoDB/Mongoose context. But I'm in a dilemma regarding best the format to use with a view to performance metrics:
I'm currently ...
1
vote
1
answer
299
views
How should I handle dealing with a stream of incoming data?
I'm creating a NodeJS application that receives a ton of incoming financial data (prices) through Websockets, like anywhere from 1 to 5 data points per second which I would then like to send to the ...
1
vote
5
answers
585
views
OOP applications and Databases
I am having such a hard time with OOP and databases. Both in C++ with SQL and even more so with Node.js and MongoDB. For this question I will use Node/Mongo.
Let's say we have a user object. Over time ...
-2
votes
1
answer
125
views
authentication flows for secured applications
There are many secured applications developed in node.js. However, I could not find any framework (like Spring-security in Java) that can be used to save the trouble of managing the authentication (...
-1
votes
1
answer
3k
views
How do I know if my nodejs application is stateless or not?
According to documentation from PM: https://pm2.io/docs/runtime/guide/load-balancing/
To make use of its load balancing feature which uses node's clustering to spawn multiple node processes, I need a ...
1
vote
0
answers
45
views
Managing external-source depending workflows and rollback
I am looking for an elegant way to manage workflows and rollback when needed but the system is depending on various external services most steps of these workflows are triggering by external sources (...
-2
votes
2
answers
176
views
Should servers exit with 0 or 1 in case of caught errors?
What is the best practice in case a service has an error which we caught and handled?
Do we exit code 1 or 0?
-2
votes
1
answer
122
views
What is the proper way to define a generic cron-job
Am going to handle a CRON job module which will be a generic module, on the job execution time shall I push the events to a queue so let the respective module will pick and do the respective operation....
0
votes
0
answers
101
views
Is it a good idea to have separate instances for the public API Server and API Server used by the Web App?
I've built a React Web application with an Express REST API server and Firebase Auth. Also, Nginx is set up as a reverse proxy, so API calls from React to https://mydomain.com/api are routed to ...
0
votes
1
answer
2k
views
Better solution instead of sending an image as binary through websocket for real time chat app
I'm building a real time chat application like Whatsapp. I have a websocket server with node+express, but I'm a bit confused on which flow I should use.
I'm considering sending the image as binary ...
2
votes
0
answers
59
views
Communicate with multiclient applications
I have a 3rd party application. Basically I need to run one instance of that application for a one user. For 10 users I have to run 10 instances. From my API
I want to communicate with a specific ...
1
vote
0
answers
71
views
advice for web communication protocol for "streaming" multiple JSON objects to multiple clients
As a hobby / to learn I am building an app in JavaScript using Node.js where a component of it will take input from a client, send it to a server, and then broadcast it to other clients. For ...
-3
votes
2
answers
202
views
How to make distinction between user establishing another connection and different user, under same network, establishing new connection
Sorry, the title of my question might be a little confusing. I have this online game that utilizes websocket connections for the users to initialize so my server can broadcast messages to all them in ...
9
votes
5
answers
835
views
Re-architecting CPU intensive Node application to handle multiple users
A few years ago, I wrote an application that allowed users to upload a file (it's a very specific file type) to a server. It then sends instructions to the server on how to visualise the data, and the ...
11
votes
1
answer
5k
views
Is it bad practice to require the same module in multiple files in Javascript?
Let’s say I have three files, all of which import a fairly large module. But I’ve divided them because they have different functions. Now each of the JavaScript files needs an initial statement like
...
2
votes
1
answer
72
views
Need advice on approach for IOT project
I need some advice on an IOT project I am working on. Here are some details about what I am trying to do:
Use Case:
Periodically receive data from the 3rd party vendor API in real time and allow users ...
1
vote
3
answers
288
views
Which of these model error handling strategies makes most sense?
I am building an API in expressjs and, currently, mongo/mongoose. I currently have some model methods that return true or false, some that return a value or false, and some that return a value or ...
-3
votes
2
answers
345
views
Cloudfront distribution having multiple domains
I am developing a multi-tenant project that will be a kind of micro "ecommerce" and therefore customers will be able to create their own stores and will be able to choose between creating a ...
-1
votes
1
answer
73
views
Best way to create a modal setup
I'm making an online food ordering platform similar to something like Uber Eats. I have the menu items stored in the database which are then sent to the front end where I use a templating language to ...
1
vote
1
answer
662
views
How can I share authentication information between all the server?
I'm developing a web service that have following structure:
Web Server: this is implemented with NextJS which do Server-Side Rendering and serve server-side rendered webpage data to Client.
API ...
2
votes
0
answers
137
views
Minimizing infrastructure code surface for NodeJS microservices and libraries
My company has about 200 repos for microservices and libraries that we share. It's largely been great, but it's hard to keep DRY at the organizational level. We'll often have a large amount of package....
0
votes
1
answer
84
views
OAuth2 not implicit flow, POST username and password
I am a mobile dev, now for a project need to authenticate with a backend service using identityserver4 and OAuth2.
The project has things set up so it is using OIDC for authentication.
BUT
It is on a &...
-1
votes
1
answer
71
views
How to design API endpoints for resources that relate on eachother?
I am developing REST API using node.js and Express.
I have Houses collection and Rooms collection. Every Room belongs to exactly one House for it's entire lifetime.
I'm not sure how to design API ...
0
votes
1
answer
65
views
System design to store pieces of data with specific ttyl to then refetch
I have a system which generates pieces of data that needs to be tracked and assigned a specific TTYL value (a value in seconds) for how long they are supposed to live before being re-processed.
I ...
2
votes
0
answers
67
views
What is the recommended way to start a long-running containerized analysis in R from NodeJS?
I have a frontend through which users can submit analysis requests, which are inserted into a database. These analysis requests are received in a NodeJS server using Postgres notify/listen. Using ...
0
votes
1
answer
51
views
Inserting dissimilar excel files in SQLdatabase
I have a bunch of excel files(Multiple sheets) with some data of similar types, but i'm having troubles when this data has to be inserted in SQL DB. the data in these files are unordered (eg: the ...
1
vote
0
answers
114
views
Reactjs + nodejs external authentication flow
I am developing a RESTful application with nodejs in the backend with express.js as middleware. I am also developing a client in Reactjs.
I want to use an external authentication service (LDAP/AD/ADFS)...
-2
votes
2
answers
367
views
Caching expensive sql queries on first page load
I have a web application with an express/node backend using typeorm and PostgreSQL. The home page in my app is a query with lots of inner joins that shows the user a complex report. This query takes ...
0
votes
1
answer
1k
views
How to launch a detached child process in Node, and reuse it on subsequent executions if already running?
I want to write a Node CLI that leaves a server/daemon running in the background, so subsequent calls to the CLI are much faster, as it can just print the latest info from the daemon (which is already ...
0
votes
1
answer
98
views
Is there a way I can make something happen on my nodejs server at a particular time
I'm not sure that I'm even asking the right question so I hope you guys can point me in the right direction here.
I have a full stack web app which has listings (think eBay, Gumtree, Craigslist) and I ...
-1
votes
1
answer
79
views
Mutexes at application logic level
In my node.js app I have a async function that fetches remote documents and caches them on the disk. Upon a retrieval request for a document first checks the disk, if found loads it from the disk ...
0
votes
0
answers
193
views
Is queue is the right choice for server request retries
I have server A that received millions of requests per day and for every request it notifies server B about it.
sometimes server B is down (maintenance, bugs etc..) so requests from server A got lost.
...
2
votes
2
answers
806
views
Modular programming: module inter-dependency
I'm looking to make a clean modular architecture. I hear all around how bad are circular dependencies, and I'm convinced that the less two modules are coupled, the most reusable the code will be.
But ...
4
votes
2
answers
8k
views
Is it okay to keep open the MySQL database connection open through out the Application or open and close connection query-wise?
I'm developing a REST API using Nodejs along with MySQL as the database.Is it okay to keep open the MySQL database connection open through out the Application or open and close connection query-wise ? ...
-3
votes
1
answer
247
views
Is splitting unit tests from integration test with mocks worth the effort (in nodejs)?
Well consider a relative simple server for a SPA application. Written in nodejs with express and knex as backends.
Now if we do it properly each function will have unit tests (as they are always all ...
0
votes
2
answers
4k
views
How to handle different types of errors in Clean Architecture?
So, in the process of creating a user there are 4 possible outcomes:
Username is already taken
Email is already taken
Username is invalid
Email is invalid
Here is what I have in the controller for ...
-2
votes
2
answers
127
views
How to abstract my development environment from external depencies
I am trying to build an API server. For the register operation I send an email to the given email address and wait for user to activate his account by using the code in the email that i sent.
I use ...
-3
votes
1
answer
174
views
Do I need MongoDB (or another type of database) to authenticate with Google?
I'm creating a web application using Node.js and Pug, and have recently been looking at adding external OAuth authentication to this site, using Express and Passport.js.
I've found a lot of examples ...
-2
votes
1
answer
87
views
Is there a less complicated alternative to handling this simple mySQL query in Node?
To Put My Question In Better Context...
I am about done writing my first real-world Node application, which would be classified as a REST API. For myself, it was a bit challenging to wrap my head ...
-4
votes
1
answer
417
views
Best way to structure reusable code using Node.JS, EJS, and front end JS?
I'm more or less learning the MEAN stack (have yet to start on Angular, so currently using straight vanilla JS for front-end) and part of what I'm building for my portfolio is a drag-and-drop form ...
-1
votes
3
answers
205
views
Can I manage thousands of concurrent connections with a non-Node stack?
I'm developing a social network with Django (Python) + Postgres SQL. My site will have a chat feature so that users can communicate to each other in real-time, and the communication will be only from ...
2
votes
1
answer
275
views
How do I send data to HTML page only when a POST endpoint is hit?
I've looked through similar questions and tried to Google what I'm trying to do, but I haven't found anything concrete.
What I'm trying to do: where I work, we use an HMI/SCADA system that displays ...
1
vote
1
answer
188
views
Modernizing legacy application
We have an application that has served us and our clients well from some 20 years now. Pretty good track record but it's obviously showing it's age in some areas.
We are looking for advise and ...
-4
votes
1
answer
469
views
Where to store the images on Server-side and not to store in the static folder and How to retrieve them on request?
I am creating a Nodejs website and the website is about selling photos, although I will store the images on the static folder but in the low quality or watermarked. But When the user Purchases that ...
-5
votes
1
answer
114
views
Why do Node.js projects not function properly? [closed]
I have been trying to use Node.js since it was first released, and in all of the intervening years, not once have I encountered a single Node.js project that worked as described when using the ...