Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [node.js]

Node.js is an event-based, asynchronous I/O framework that uses Google's V8 JavaScript engine.

0
votes
3answers
133 views

If callback function, promises and async/await patterns all can be used to achieve asynchronous behaviour then why don't we stick to one?

As far as I have seen then async/await, callbacks and promises are and can only be used to achieve asynchronous programming. Correct? So my questions are: 1) Is it correct that the former three is ...
1
vote
0answers
19 views

Viable ways to handle an access token on the resource/web application server

Use case: We have a product which ties a set of resources to a concrete user. Now we would like to provide the customers with an API so that an automated client application can have access to a ...
0
votes
0answers
17 views

Provide user access on credit card transaction

I'm sorry if it's not a correct type of question to ask on this form, I just don't even know the name of the concept I lack understanding in. Basically I have a database where users have access to a ...
1
vote
0answers
75 views

Refactor MVC to more scalable architecture?

Months ago I began a new web project which, in the beggining, seemed like a small application with virtually few users. I began the project by using the awesome Hackathon Starter WebApp Boilerplate by ...
0
votes
0answers
29 views

Sending push notifications to android by nodejs server

I am having the requirement in my project, that nodejs server has to send the notification (kind of push notification) to our mobile, and user( or mobile holder ) have to act on that notification like ...
-1
votes
1answer
34 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
votes
1answer
41 views

How to ease the pain of lack of diffs when using database migrations?

The pain that I've often felt when creating database migration files, is best described in this Speakerdeck: Sane Database Change Management with Sqitch. Paste entire function to new "up" ...
0
votes
1answer
113 views

Architecture for a Reddit-esque website

I'm trying to create a website as a forum similar to Reddit, but on a smaller scale (no comments also). The website will allow users to post a link to a forum. Then they can view a list of New or ...
1
vote
1answer
76 views

Why are unnamed placeholders recommended over named ones?

While setting up a nodejs server with a mariadb database, I found this: While the recommended method is to use the question mark placeholder, you can alternatively allow named placeholders by ...
4
votes
2answers
145 views

Clearing up misconceptions about a Flask backend and client-side rendering

I am building a website and along the way I have come across a lot of things I didn't know about and was hoping to get some help in understanding some of them. I started building a website using ...
1
vote
1answer
33 views

Correct way to serve file that's in node_modules

Say I have this structure: project/ node_modules/ xxx/ asset.js index.html app.js and in app.js I have: const express = require('express'); const app = express();...
0
votes
1answer
66 views

Best route naming convention when a RESTful GET needs to be a POST

I have a REST API that has been built on top (in front of) a legacy system, to allow 3rd parties of various platforms to interact with the system. Most of the time, I can define a resource and create ...
1
vote
0answers
26 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 -...
11
votes
3answers
527 views

How can I prevent a user from editing my code in their browser?

Description I'm designing a Node.JS application (more like a full website). The app will send five JavaScript files and will have <script> tags linking them together. Question How can I ...
-1
votes
3answers
100 views

Writing elegant promises in Node.js

I am having a real difficult time writing some clean code with a simple user registration/login manager. I am trying to stay out of nesting/callback hell, and am also not seeing any benefit in using ...
-3
votes
2answers
180 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 ...
2
votes
1answer
315 views

Best practices for Docker image node version and .nvmrc

If I'm building microservices using Node on Docker images - it's necessary to keep an idea of what version of Node I'm using. The idea is - I'm going to be running Node locally in development - and ...
0
votes
1answer
181 views

What is it that is so hard about ES6 modules for Node? [closed]

It seems like ES6 imports for Node have been a bugbear for a while. There is the --experimental-modules flag, or options like using Babel - but AFAIK ES6 modules still aren't supported in vanilla Node....
1
vote
1answer
253 views

How to store blog post in database - React & GraphQL

I am building travel blog using React as frontend Javascript framework along with GraphQL. I am doing this project by myself as a pilot test and I am currently in a phase of translating photoshop ...
4
votes
1answer
292 views

Managing private NPM packages and CI/CD

At work we have an application that is run directly on dev machines, but deployed to Docker swarms (a QA swarm and production swarm). The code and CI/CD pipelines are all in GitLab CE. It uses ...
4
votes
1answer
59 views

How do I automate build-publish tasks for my web server?

I'm developing a node.js web server which will have built source code of server and client part at once. I mean, my web server is on the isomorphic level. this means editing source code of client part ...
0
votes
1answer
61 views

How to route/implement port forwarding with AWS/Apache web server (httpd) with a Node.JS app on port 3000?

I'm trying to understand this and having a hard time. I usually use Ubuntu server, with Apache2, and this time I am not. So I'm a bit out of my element. I'm also a software developer and I don't do ...
3
votes
1answer
318 views

NodeJS (ES6): Design Pattern with bind usage

The question is related to the resolution of the this operator in Javascript classes. NodeJS now supports ES6 classes. The problem faced during this is that when a new instance of the class is created ...
0
votes
0answers
69 views

How to create a router-like configuration page on Raspberry PI?

We have a Raspberry PI (with raspbian OS) that runs some application, this application uses a local configuration file that contains some data like username, password, server url etc. We will provide ...
1
vote
1answer
38 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 ...
-3
votes
1answer
95 views

ASP.Net WebAPI or Node JS?

I wish to write RESTful web services which can be consumed from a Web Application and a mobile application. The database is designed in SQL Server 2012. I estimate that there won't be more than 1000 ...
-1
votes
1answer
82 views

How to develop larger client-site in-browser apps in javascript?

I'm new to javascript environment (I have background in C++ physical simulations and game engines). With rise of HTML5 and WebGL I was thinking I'd like to try make some games/3D editors using ...
0
votes
1answer
185 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
1answer
63 views

Upgrading outdated node.js with many dependencies, should it be done incrementally?

If one wishes to upgrade from Node 0.10.48 all the way to the latest LTS version (8.11.2 as of right now) would it be smart to upgrade only to version 0.12.18 first, and then to 4.9.1 and so on? The ...
0
votes
0answers
87 views

Defining a Semtech UDP protocol packet: Is good idea to use google's protobuf

In an attempt to make a LoraWan node simulator using node.js: https://bitbucket.org/lora_ssl_unipi_sec1718/lora_node_simulator/src/master/ But I have a hard time to define a packet in a similar ...
-7
votes
1answer
122 views

Writing tool to make large number of http requests with sub second accuracy

I'm pondering a project in which one component needs to make a large number of http requests at accurate times. It should, let's say, release a set of 'dozens to hundreds' of requests at 1 second ...
2
votes
1answer
72 views

Does using MEAN stack reduce the need for code and data structures compared to ASP.net with SQL?

I've been writing web applications for almost 10 years. The ASP.net stack has been my bread and butter and although it has a lot of great things about it, I honestly never chose ASP.net. It's just a ...
0
votes
1answer
44 views

Is it a good idea to pass an URL as a parameter for a pass through service?

I'm developing a service in node JS that will act as a middleware for a client calling a third party API. My service will make some security and user roles checks before calling the third party. So ...
2
votes
1answer
122 views

What is the best way to maintain synchronicity between a table that has a list of another table?

I used to do Java development and with JPA, I don't really have to worry about the synchronicity between a table and the lists it owns. For those who don't understand what I mean, here's an example. ...
0
votes
0answers
29 views

GIS design for reducing of traffic and number of requests to server

I explore the world of GIS and try to elaborate an architecture of a GIS service with a lot of objects on a map. Currently, I'm loading all the items in the visible map area. In order to keep a map ...
7
votes
2answers
384 views

Do CPU Intensive/ Data Intensive Tasks belong on the Server

I'm new to server development, and I'm trying to figure out where the division of responsibilities is for Data intensive tasks, I'm using Node.js. As an example say I'm making a Single Page ...
-5
votes
1answer
138 views

Performance comparison of Legacy VB6 Software vs Node.js and React.js

my company just started a new production management software by using serial communication to scales. My company has already developed the software using VB6 in 2006 and keep using that outdated ...
3
votes
2answers
120 views

Securing an API key in a web extension

I'm building a web extension that will be a wrapper for a public API. There aren't any paid tiers for the API currently, but I'm trying to secure the API key so it doesn't get stolen and used outside ...
0
votes
1answer
105 views

Algorithm for graphing heap data from server memory, over long period of time

Right now I am collecting memory information on a node.js server every 100 seconds. I want do display the memory usage info as a graph on the front end. const mem = { heapTotals: [], heapUseds: []...
0
votes
0answers
103 views

LGPL restrictions for a module in a nodejs project

I'm using an open-source LGPL module in a commercial Node.js project where we deploy our Node.js code on the client's servers. I've read that, amongst other legal specifications, i should make it ...
3
votes
2answers
138 views

Does prefetch data by Apache before serving a SPA site hurt performance?

I have this application containing 2 parts: User-facing SPA web served by Apache NodeJS API server When a user go to the SPA web, Apache will do authentication and prefetch data for that user by ...
1
vote
1answer
135 views

How to create a framework in Express.js

I'm trying to figure out how to create a Node.js/Express.js application that is a framework for hosting and running third-party code in my application, and what are the appropriate JavaScript/Node/...
1
vote
0answers
571 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 ...
-2
votes
1answer
155 views

Linux Server Hosting through Cloudflare [closed]

I hosted a hobby NodeJS Server from my Linux and all is fine by accessing my direct IP. Because I find this ugly and also less secure, I decided to route my domain which is set to Cloudflare to my IP....
3
votes
1answer
172 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
1answer
313 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
1answer
46 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
0answers
48 views

How to implement a session mechanism for an always-open SaaS platform

The SaaS platform I'm working on should have a rather desktop-app-esque feel to it. Meaning it would be the main management software for my client's businesses and will be always open on their ...
0
votes
1answer
240 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'...
1
vote
1answer
309 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 ...