Most voted "node.js" questions
Node.js (or commonly Node) is a Javascript Runtime created with Chrome’s Javascript V8 engine. It allows you to run Javascript code without the need for a browser, raising the privileges to those found in other desktop languages. It is a technology strongly focused on non-blocking programming of I/O operations, which makes it very efficient for these operations.
Learn more…2,679 questions
Sort by count of
-
3
votes3
answers707
viewsForeach wait for the select result to proceed
I have a forEach which traverses a code list and within it I have a select that queries the database records. After the forEach, data is sent from my server to my client, but forEach does not expect…
-
3
votes1
answer428
viewsPHP - Real Time Application
A doubt I need to make an application that from time to time validates whether a session is valid through a bank query. This query must be done automatically, without the need for a user action,…
-
3
votes1
answer7991
viewsHosting for Node.js
Good morning, I have 2 applications Node.js with Mongo, and needed to host them in the same place, one application manages the other, use the same database. It is possible to put them in the same…
-
3
votes2
answers1432
viewsQuery return in Javascript variable
I am making a code in Node.js that accesses SQL Server database. I created a variable that stores the result of a query, the problem is that I can’t access this variable outside of the connection…
-
3
votes3
answers756
viewsTransform a Json Array into another JSON using Node
Good morning, I’m having a problem assembling a JSON using Nodejs. I have a return of a giant SQL that basically follows the structure below. [ { "numDoc":"0000001", "OutrosCampos":"outrosDados",…
-
3
votes0
answers717
viewsError using npm in Windows 10
I have a problem when I will try to start an application using nodejs in Windows 10. Every time I use any npm command (except -v) the following error is displayed Error: Cannot find module 'verror'…
-
3
votes1
answer717
viewsHow the Node thread pool works
Assuming that Javascript, both in browser and Node, is single thread (correct me if I’m wrong), like thread pool works? If, for now, my server does not receive many requests or is in development (it…
-
3
votes1
answer451
viewsRecover value using Node.js and mssql
I’m having trouble recovering a value using the mssql library I tried to put a variable in the global scope and update the value using recordset, put everything inside a function passing the value…
-
3
votes2
answers1580
viewsConvert utf-8 codes to Unicode
Well, I have a file JSON where all the symbols Unicode as this " " are in this format: "u2605" has some way to convert these codes to the symbols when my program Nodejs read the JSON? Example of how…
-
3
votes2
answers1634
viewsImage is not displayed when listed on Node Js
I am unable to list the saved images on and Ode with express, when I try to list my View does not display the image. My configuration file: module.exports = function(){ //recuperando a biblioteca do…
-
3
votes1
answer1319
views"ORA-01756: quoted string not properly terminated"
Speak guys, good morning, I’m with a legacy code and I’m having the following difficulty: When I try to check any word that has simple quotation mark I get this error ORA-01756 Ex: Raphael me'lo now…
-
3
votes2
answers9712
viewsWhat does the npm build command do?
I don’t know much about Node, but I understand that the npm is a package manager for Node. As far as my vision goes npm I can download the project packages in a more practical way, I can host my…
-
3
votes1
answer45
viewsCouchdb best practices for updating related documents
I’m using CouchDB and NodeJs with these examples of documents. Role { _id, name } User { _id, email, password, role: { _id, name } } What is the best practice for when I update a Role, also update…
-
3
votes1
answer361
viewsUse of routes at the frontend or backend
In relation to routing, it is more appropriate for routing to be on front and the same make requests to the server through AJAX, or the routing stay in the back and render the same views of front?…
-
3
votes1
answer327
viewsNode.js V6.11.5 error in Windows 10
I installed Node.js to study Angular 2, I downloaded it from the Node website, but after installing, when I type npm start in cmd of my PC, I get the error below, I am giving command in file folder…
-
3
votes1
answer203
viewsReturn Array inside the other
I have the following array Array ( [0] => Array ( [id] => 232 [menu] => Energia [logo] => fa-bolt [url] => # [submenu] => Array ( [0] => Array ( [id] => 209 [menu] =>…
-
3
votes0
answers51
viewsDeploy of Node applications
Hello I’m starting to study Ode and I came up with a question, how to deploy an application in Node? Today I work for a company as a developer and we host our application on an Azure server and use…
node.jsasked 5 years, 2 months ago Guilherme Britto 31 -
3
votes2
answers3004
viewsHow to open a local server using Node?
I want to open a local server to test my project on Reactjs, but I want to see it both locally on my machine and on another computer. I have to open some door? Edit: Both using the same network.…
-
3
votes0
answers546
viewsBematech with Nodejs
I’m trying to connect printer Bematech MP-4200 TH with Nodejs but I can’t. var stream = fs.createWriteStream('/dev/ttyACM0', { encoding: 'utf16le' }); When I run nothing happens, it’s not printing.…
node.jsasked 6 years, 6 months ago Victor César 149 -
3
votes1
answer4074
viewsWhat does Expressjs urlencoded mean in practice?
Analyzing a code built on the Nodejs platform, I came across the instruction express.urlencoded({ extended: false }), to try to understand it, I ended up using the Expressjs documentation, however I…
-
3
votes1
answer68
viewsHow do I save the output of a REGEX to a new file
const dirfile = 'BIG_DATA.HTM' const reg = /(\<td .*)/g const fs = require('fs') const myReadStream…
-
3
votes1
answer63
viewsGraphql error with Sequelize
I have an error in the return of a Mutation. Apparently he can’t read the id field, but the object I send to Graphql has this field, and as I’m new to Graphql I don’t understand what the error…
-
3
votes1
answer39540
viewsError. Unhandledpromiserejectionwarning
In the browser, the following code works normally: const get = async () => { return Promise.reject('Oops!') } get() .then(console.log) .catch((err) => { throw new Error(err) }) But on Node.js…
node.jsasked 6 years, 3 months ago Luiz Felipe 32,886 -
3
votes1
answer322
viewsNode Fs.js running in HTML
Hello, I need to use Node.js’s Fs function but am encountering errors. When running using Node use_fs.js it runs and works perfectly. However when I put it into html it always says q require is not…
-
3
votes1
answer119
viewsHow do you protect a stateless API built on the Adonis framework against CSRF and XSS attacks?
Consider a REST API stateless with all endpoints protected with authentication, except endpoint for authentication. The authentication endpoint returns a JWT which is later sent in all requests…
-
3
votes1
answer721
viewsGet IP from the computer that is accessing application via Node.js
I have an application . Net where for each access is recorded log with IP of the access machine, time etc. No. Net I use Request.UserHostAddress in the login POST to pick up the IP of the machine…
node.jsasked 4 years, 6 months ago Deividson Oliveira 503 -
3
votes1
answer3164
viewsCreate folder/directory with Node.JS
There is the module "Fs", which is used to create files: const fs = require("fs"); fs.writeFile(`./teste.txt`, "conteúdo", function (erro) { if (erro) { throw erro; } console.log("Arquivo salvo com…
node.jsasked 4 years, 6 months ago Gabriel Ribeiro 495 -
3
votes2
answers157
viewsHow to create a property on an existing object of an http request?
I’m trying exhaustively to put a property on an object that comes from a request (JSON), but I’m not getting it, it’s like it just doesn’t, but when I do a console.log, there it is, but it’s not…
-
3
votes0
answers1298
viewsXML digital signature with Nodejs
Good morning I’m using the xml-crypto and the pem to sign an XML. However after searching I did not find a way to solve this problem: var certificado = cert.cert.toString().replace('-----BEGIN…
-
3
votes1
answer342
viewsDate coming with date tomorrow instead of today
My date’s coming up with the wrong date, tomorrow’s coming up plus I want today’s date. For my application the date and time cannot be wrong. I’ve checked the date on the server and it’s correct:…
-
3
votes1
answer51
viewsChange the native console function.log
There is some way to change the console’s native function.log, but keep the old one? Ex: console.log = (e) => { antigoConsoleLog(e); alert(e); //exemplo minhaFuncao(e); //exemplo }…
-
3
votes1
answer335
viewsReq and Res no nodejs, problem in understanding arguments
I found myself with the problem of understanding in depth what res and req means in Node js, but it is necessary to understand the problem, I understand everything about what res is, and what req is…
-
3
votes1
answer700
viewsJS does not work after running "npm run dev"
Good afternoon, I am studying the Laravel 5.7 and was wanting to use a plugin called progressbar.js. One of the ways to install the plugin, is by playing the file progressbar.js right in the…
-
3
votes1
answer401
viewsEmpty input after submitting form
Hello, I am developing a login system, but I would like to improve something. When I register a user, and type his name, address, etc., and request the form, he returns all empty inputs. As in the…
-
3
votes1
answer681
viewsRefresh part of web page with Electron. (Change content only and keep header, footer and fixed menu)
I’m making an application using Electron, divided the screen into header, footer, menu and content as done in a common web application. The buttons need to perform the actions in the main Electron…
-
3
votes0
answers28
viewsWhat it means to declare const {service} in Javascript, NODE.js
When I started studying Node.JS I came across the following code snippet: Example with services that shows middleware Factory Advantages. ... const {service} = options; router.get('/greet', (req,…
-
3
votes1
answer89
viewsHow to read this JSON correctly? MSSQL and Node
{ "recordsets": [ [ { "IdUsuario": 5152490, "strNome": "Roberto ", "IdPapel": 1 }, { "IdUsuario": 5152490, "strNome": "Roberto ", "IdPapel": 3000001 } ] ] I am trying to return to the customer only…
-
3
votes0
answers39
viewsHow to use a counter value within asynchronous function
I wonder if I have how to pass some external value into the asynchronous function keeping the value of when the function was called. for(x=0;x<array.length;x++){…
-
3
votes1
answer703
viewsNodejs - Problem sending a POST with object array
I’m using Nodejs + Mongodb, and I’m trying to send an array of Book, via method POST, but somehow it’s giving problem, because when using Postman and clicking Send, it just returns me: { "_id":…
-
3
votes1
answer446
viewsSelenium on Node.js, Webdrivererror how to resolve?
I am using windows, using Node.js with Selenium to do automation of a website. my problem and they are giving error in function click(). Code below is the example already ready when type npm install…
-
3
votes1
answer123
viewshow to generate an index.js for each build - Webpack
I am working on a nuxt/Vue.js project and applying the Atomic design methodology, so I will have many components, in different folders, example: ├── components │ ├── quarks │ │ └── ... │ ├── bosons…
-
3
votes1
answer1084
viewsReturn value of Promise
I have the following code: const retorno_valores = [] result.forEach( value => { var reader = getReader(conn, 10) retorno_valores.push({reader}) }); const getReader= async (conn, cdReader)=>{…
-
3
votes1
answer50
viewsEnter sudo password after running Spawn command
I’m trying to make a script on Node.js to update my computer. I’m using child_process.spawn. When typing sudo apt update, it keeps waiting for the password. I have tried to inform with stdin.write,…
-
3
votes1
answer341
viewsExpress with Typescript: "Element implicitly has an 'any' type"
I’m trying to dynamically generate my application routes with the Express.router() using Typescript and Node, but it doesn’t work and I’m not able to understand why. If anyone please knows what is…
-
3
votes2
answers4009
viewsHow to upload an image to the backend
I have an application in React that sends an image to the backend in Ode the problem is that I can’t get the file in express. I see you have a way to use the woman, only I don’t know how to get the…
-
3
votes3
answers1466
viewsTypeerror: Cannot read Property 'filename' of Undefined
I intend to store the file in the folder uploads and secure in the bank the name of the file. The console.log() show me this: {theBook: undefined, cover: undefined} Stores the image in the folder…
-
3
votes1
answer38
viewsTerminal printando in yellow
Hello, I am learning Javascript and in my terminal, when I run some code, some prints come out in yellow. Does anyone know why ? Thanks. const peso1 = 1.0 const peso2 = Number('2.0') const peso3 =…
-
3
votes1
answer464
viewsWorking with PDF files on Nodejs server
Hello, I have a service that when performing a request via Postman for example, I get a file . pdf I’m calling this service from a new service nodejs, but I’m not getting the . pdf returned in a…
-
3
votes1
answer66
viewsInsert an information into two Collections in Mongodb with Node.js
I have two degrees: courses and participants. an attendee when enrolling in a course, when I give a GET in any course, needs to return the enrolled attendees(participants) and when giving a GET to…
-
3
votes2
answers928
viewsHow to hide Axios request data in Javascript (JS Node)
Hello, I’m developing an application and setting up a user registration screen, but I’m wondering if it’s possible to hide the data that Axios is requesting for the API. My Javascript code, which I…