All Questions
Tagged with node.js design-patterns
26 questions
3
votes
3
answers
448
views
Is it a good idea to wrap node.js package functions in a micro-service architecture?
Our development team works with a micro-service node.js architecture. This means we work with a very large amount of repositories that currently each take care of their own dependencies.
To avoid ...
-4
votes
1
answer
403
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 ...
-2
votes
1
answer
768
views
Design pattern for a switching between APIs with no code changes
I'm trying implement in JavaScript/Node.js a data upload functionality. I want to be able to switch between different storage providers, e.g. AWS, GCP, Azure, with no code change, for instance, via ...
0
votes
1
answer
2k
views
Doing data manipulation on server side vs client side
Im building a project that stores time series data on a per user basis. On the dashboard of the user it'll show some simple statistical analysis like averages but more importantly, it'll create charts ...
-2
votes
1
answer
754
views
Adding unstructured data to a relational database (PostgreSQL)
I'm building a project and I only know the MERN stack. Everywhere I see the general consensus is that Mongo is not good and should only be used in very specific use cases. More importantly, I also ...
0
votes
0
answers
650
views
DRY(Don't repeat yourself) Principle and BFFs (Backend-for-Frontend)
We are about to plan our server architecture and we want to use the BFF strategy with node.js servers to serve multiple front-end apps.
However we also want to be able to scale easily (e.g. a new ...
2
votes
2
answers
250
views
What pattern lets each of multiple "voters" decide on a central status?
Imagine there's a boolean status variable that is either running or stopped.
This variable is running by default and comes together with a deactivator function.
When a client calls the deactivator ...
4
votes
2
answers
777
views
Heavy task exposed via a REST API
A part of a system I am currently reviewing, consists of a master node which calls several slave nodes using REST APIs.
The slave nodes are scattered throughout the world on different servers, and ...
-1
votes
1
answer
409
views
Node.js / Express.js - Route consisting almost entirely of middleware
Is it a bad design pattern / anti-pattern to create a whole bunch of specific middleware to replace functions in-route. So instead of doing this
router.post('/myRoute', (req, res, next) => {
...
1
vote
0
answers
37
views
avoid passing dbsession object to multiple modules
I have a project which has a service-oriented architecture. for example, anything relates to payment is inside payment module.
-dao
-config
-constatnts
-middlewares
-modules
-payment
-user
-...
-3
votes
2
answers
363
views
Is this an anti pattern in Javascript?
A common pattern I've been using for JS/NodeJS applications is the following:
import { utility1, utility2 }
function exampleScript() {
utility1()
utility2()
// Does something
}
Basically my main ...
1
vote
1
answer
54
views
JavaScript/NodeJS Class Extension vs Adding Properties
I am currently writing a Discord bot and have reached the point of needing a refactor. With this being my first stab at JavaScript/NodeJS and making a bot in general, there are a lot of mistakes I ...
0
votes
1
answer
544
views
Class definitions in static getter methods
[Node.js / CommonJS]
I'm creating a single GitHub repo for my tool which has a Core, Control, Server, and Client library. It's unlikely that all of them will be used at the same time.
I'd like my ...
1
vote
0
answers
3k
views
design pattern/oop for large validation rule set
I'm writing this in node.js
I have some data that needs validating before anything can be done with this. The data is validated in two different ways. I can use JSONSchema to validate the structure ...
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 ...