Questions tagged [node.js]

Node.js is an event-based, non-blocking, asynchronous I/O runtime that uses Google's V8 JavaScript engine and libuv library. It is used for developing applications that make heavy use of the ability to run JavaScript both on the client, as well as on server side and therefore benefit from the re-usability of code and the lack of context switching.

Filter by
Sorted by
Tagged with
0
votes
1answer
12 views

Sequelize - How To Design One To One Association?

I am creating two models, the first one is User and the second one is Portfolio. When a user is creating a Portfolio (where a user can only have one Portfolio), I want it to have reference to the user ...
0
votes
0answers
4 views

How to deploy a snippet created in Word scriptlab to word store for individual testing?

I have created a simple add in for word on scriptlab. Now I would like to deploy it in word store. I don't want to make it public at the moment. I would just like to be able to download my addin from ...
0
votes
0answers
11 views

DELETING MULTIPLE ROW CHECKBOX DATA IN MYSQL USING NODEJS

i want to make multiple delete or checkall data using mysql and NodeJS but not working. this is my code. <form id="add-row-form" action="/api/delete_masterdata" method="post"> <div ...
0
votes
1answer
15 views

Blocking the incoming request even after promisify

I am having an express get method which in turn makes a HTTP request to Git Api. I am invoking GIT API using Http module and calling it inside the promisify method. I am getting the proper output. But ...
0
votes
0answers
13 views

Node automatically generate migrations from models

Working on a new app and was planning on using NodeJS for it. I'm finding one of the areas it really falls short is with migrations. Basically, it seems like you have one of three options: Use ...
0
votes
0answers
7 views

How can post and populate todos (no relational array) inside service? todos: no relational nested array. service: model's object

I'm trying to insert one document called "service" from Collection "services". I want see todos inside service object, but I only see todo id. May you help me, please? this is my code: the schema: ...
0
votes
0answers
9 views

How to solve encoding when piping file from NodeJs Cloud Function?

I'm attempting to pipe a file in Firebase bucket through a nodeJS cloud function to the client (browser). The client will use file-saver.js to start the download on the browser. This works well with ...
0
votes
0answers
13 views

how to fix “The operation was rejected by your operating system” error when installing vform?

I am trying to install vform (a Laravel and Vue form validation plugin) through NPM by using the command "npm i axios vform" but it gives the following error I tried to check wether and other app ...
-1
votes
0answers
15 views

How should I store an array in redis?

I have a query that returns an array of objects in javaScript (json) and I need to save it in redis without the need for a foreach, actualmente use el comando set de redis y convertí el arreglo json ...
0
votes
2answers
17 views

Filtering Mongoose document that contains array of object

I would like to know how to retrieve documents in MongoDB using mongoose that all have the value true for the "done" property inside an array of objects. Something like this : this one should be ...
-1
votes
2answers
42 views

Why can the parameter in arrow function be passed on like this?

I was watching a YouTube video talking about promises in JavaScript and came across some code that I don't really understand: const recordVideoOne = new Promise((resolve, reject) => { resolve('...
0
votes
0answers
21 views

React hook error when using Material-UI styles

I've been teaching myself React and node.js in my free time, and am hitting a wall with why my use of material-ui's makeStyles is breaking react hook rules. I've been replicating the code from the ...
0
votes
1answer
14 views

Docker access localhost in browser

I use Docker Compose for Windows and I can't access to localhost:3333 from browser (Windows). This is my docker-compose.yml version: '2' services: data: image: mongo:latest volumes: -...
0
votes
1answer
26 views

Node API: Paramterization in routing

I'm trying to build up an api for my website. However I kind of struggle with the route params. I have two routes for now: const route1 = require('./routes/route1') const route2 = require('./routes/...
0
votes
0answers
25 views

Node child process, not getting the output from CLI

I am trying to run a basic cmd command with a child process, i am testing some cli's with nodejs and can't understand why i am not getting any output, here is a simple example: const spawn = require('...
0
votes
0answers
16 views

Aggregate is not a function mongoose js

how are you?, I'm trying to find one field of client with out seeing the entire Document, only the field I want. This is my code: app.get('/api/clients/adress/:street', async (req, res) => { ...
0
votes
1answer
19 views

Persisting authentication with Access Token and Refresh token

I'm trying to figure out how I should persist authentication. Let's say that the user authenticates successfully with email and password. So then the server generates and returns two tokens: ...
0
votes
1answer
25 views

How to handle async call to mysql database

I'm pretty new to nodejs which is probably why I'm asking this question. I recently discovered that calls being made with nodejs to any database are async. As a former C# .Net programmer this is ...
1
vote
0answers
21 views

Trying to understand spawn in node.js REPL

I'm trying to understand how node works when it comes to child processes and event listeners. So, if I put the code below in a file and run it at the command line with node all at once, I can see the ...
0
votes
0answers
7 views

How to resize and image before saving it with gridfs?

i'm a beginner with mongoDB and gridfs. I have a code which save in the database an incoming image. But I'd like to resize the image before saving it. It tried to use sharp, but I don't really ...
0
votes
1answer
27 views

CSS will not appear with HTML and Node

CSS styling will not appear with my HTML when running in Node. Directory: Login_Page_V2.html Login_Page_V1.js public     -css         -...
0
votes
0answers
27 views

Why this Node app returns 504 after few minutes

I have this nodejs app setup up on cpanel and it is suppose to be working for 2 hours but when requested it returns 504 Gateway Time-out The server didn't respond in time. just after a few ...
-2
votes
1answer
20 views

How to convert excel data to mongodb

I have excel file which contains some records. Requirement is I have to convert it into Mongodb database. I looking NodeJS solution. Is there any way to do it??
0
votes
1answer
21 views

How to write an alternate function of util.promisify in Node js? [duplicate]

I want to explore util.promisify in nodejs. My below code fetch the data from files and also print for util.promisify which is now comment. I started to write my own function similar to promise which ...
0
votes
1answer
23 views

Fetch Api Error: SyntaxError: Unexpected end of JSON input

Im working on this api and for any reasson it returns me the message Error: SyntaxError: Unexpected end of JSON input. Im doing MySQL-connection, in here everything is ok but, the problem appears ...
0
votes
1answer
20 views

How to fix “UnhandledPromiseRejectionWarning: ReferenceError: content is not defined”

I'm working on the bot. I used ping template from example bot yet it when I use the command it does not work. (node:5696) UnhandledPromiseRejectionWarning: ReferenceError: content is not defined ...
0
votes
2answers
21 views

Firebase Function returned before data is fetched completely

Firebase function return ob2 before data is fetched from firestore via loop return admin.firestore().collection("doctors").doc(data.type).listCollections().then(function (doc) { // console.log(...
0
votes
1answer
28 views

Is there way to run React app in nginx(Docker, nginx knowledge required)

I have react app and nodejs api server. React app make fetch requests to nodejs server. React app and nodejs server deployed in own containers. The problem is I can access nodejs server directly in ...
0
votes
1answer
14 views

How do I use readline for Discord Bots?

While trying to make my Discord Bot I ran into yet another problem. I'm trying to have a way to have the owner have the bot say something in the announcement section for me so it doesn't show up as my ...
1
vote
0answers
30 views

What is happening under the hood of nodejs?

Consider this snippet of pseudo code: i = 0; while i < int.maxvalue { print(i) i += 1 } While running this code in nodejs it started eating my RAM and crushed at the point of 2 GB, while on ...
0
votes
1answer
13 views

How do we delete all of the comments of an user if comments don't have their own model?

So I am trying to figure out how to delete an user's comments on mongoose, but I am not sure how, but it's mainly because the comments on my application don't have their own models. If I really ...
1
vote
1answer
34 views

Destroy JWT token, force logout when user gets banned or edited

Good day friends, I am developing an application, in my user system add the functionality for administrators to raise the level of the account (if level 10, it's admin) or ban it from the site. Once ...
-1
votes
1answer
16 views

Aplikacja w node.js nie sprawdza wszystkich danych w pliku

Witam. Mam takie coś komenda.js let dataJSON = JSON.parse(fs.readFileSync("./data/file.json")); if (message.author.id === dataJSON.bannedMembers) { return message.channel.send("Masz bana. :D"); }...
0
votes
0answers
14 views

How to set proxy pass for react app on nginx?

My react app has got different routes to consume different functionalities e.x. localhost:3000, localhost:3000/Dashboard, localhost:3000/Hub, localhost:3000/Person etc.... I wanted to ...
0
votes
0answers
14 views

CORS request did not succeed, webpack socket.io client

I m using webpack with socket.io-client(localhost:9000) on mi client side, and i trying to connect to the server side socket.io(localhost:3001) server ///server side const app = require("express")();...
-1
votes
0answers
21 views

Encrypting communication between between Microservices [on hold]

I am dealing with communication between microservices. Microservice A - Angular6/django Microservice B - NodeJS My Microservice A is in company network and Microservice B is in AWS. we need to ...
0
votes
0answers
8 views

Electron: Access appId in production

How can i access my appId in my electron app? the appId would be "com.somethinghere.somethinghereagain". Is it even possible? I cannot find any documentation regarding this. For example, something ...
0
votes
0answers
29 views

How to find index of the First Non-Zero Digit of a number in Javascript? [duplicate]

I am trying to find the index of a first non-zero digit of a number. For Example: 0.01 -> index will be 2 as 2 decimal points away from point '.' 0.00234 -> index will be 3. For this I did write ...
0
votes
1answer
27 views

How can I use the let variable on scope outside the socket event, in the Node.JS code?

How can I use the let variable 'equipe' on scope outside the socket event, in the Node.JS code? socket.on('equipConnected', (data) => { let equip = equips.Equip.deserializeBinary(data); ...
0
votes
1answer
18 views

POST with multipart/form-data using node.js supertest

I was trying to use the Node.js supertest to test some REST API. request(app) .post("/products") .set( "Authorization", "Bearer my jwt token here" ) .set("...
0
votes
1answer
8 views

Process only first x bytes of a stream, preserve stream contents

I have a function that takes in a stream function processStream(stream) { } Other things process this stream after the function, so it needs to be left intact. This function only needs the first ...
0
votes
0answers
39 views

Axios is not getting data from server after several request

I have React & NodeJS application and i am fetching data from server and it works but only for several requests, after 5 or 6 reloading of page axios is not getting data anymore, i am not using ...
0
votes
0answers
13 views

web exceptions information getter

I am web developer, need to write javascript to get all information from web exceptions. My problem is that I work by 2 navigators chrome and Mozilla. The Chrome navigator print Exceptions with format ...
0
votes
2answers
43 views

MongoDB - running queries from a file in NodeJS

I am working on a project, comparing times of processing queries with and without caching on different DB systems. Now I am using nodeJS and mongodb. I have a txt file with queries (or more like ...
0
votes
0answers
12 views

Many-to-many associations using Sequelize using Nodejs

I was trying to create a many-to-many association between Product and Order model I have created 3rd table between Product and Order table is Orderline as image here I have read a guide is create ...
0
votes
0answers
16 views

Nodejs & TypeORM Transaction Confusion

I have confusion and I couldn't resolve it from the TypeORM documents. Here is my function that is used as request handler and it is using transaction taken from getManager() static makeTransaction ...
0
votes
1answer
22 views

Global Variable not changing value in function [duplicate]

I have a nodejs app and I am trying to pass a value called membership to a page. I initialize it and try to update its value in a function but the output doesn't change. It still outputs 0. Please I ...
0
votes
0answers
8 views

Paypal subscriptions using ReactJs and Nodejs

I am trying to use the paypal-rest-sdk API to allow users to pay for subscriptions. I was able to create an app, add a product, add a plan, and add the frontend button. I'm having trouble with the ...
0
votes
0answers
21 views

express 4.0.0 generates deprecated dependencies and vulnerabilities

Having installed all the default versions from the Ubuntu 18.04 LTS repos: nvm 0.35.0 node v10.16.3 npm 6.9.0 express 4.0.0 All the following commands (provided in the express starter tutorial and ...
0
votes
0answers
8 views

serializeBinary() not found using google-protobuf on nodejs

I could really use some help. I am trying to follow along on the google-protobuf example: https://www.npmjs.com/package/google-protobuf However, when I try this line of code: // Serializes to a ...