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
-
1
votes0
answers15
viewsSchedules on a large scale
I have a service that will be used on a large scale, and one of its specifications is to perform a database change after 10 minutes of the HTTP request coming to the server. I could use a…
-
1
votes0
answers36
viewsFind API app automatically
I have an application that requests a local API and I need to change the machine API because I can use multiple servers and they can have different Ips. I would like to have my app search the server…
-
1
votes1
answer780
viewsHow to list files in a directory and use in an Angular2 + Webpack project
Hello, I am creating a project in Angular2 + Webpack and in this project I use as a design library @angular/material. So I can create my own icons using SVG, I’m extending the component MatIcon as…
-
1
votes1
answer75
viewsCheck all the requests
Hello, I am using express-Session and would like to know how to verify the session of all incoming requests on the server. For example, today I’m using the stretch on all my routes:…
-
1
votes2
answers3397
viewsRead serial port data with javascript, Node
Problem : Search for an alternative to read data from a COM5 usb port, with bound 115200. I’m working with a libelium waspmote sensor, Alternating current meter, this sensor emits data via usb, and…
-
1
votes3
answers289
viewsSet NODE_ENV via command line on Windows
I am taking a Node.JS course the instructor executes the following command to change the environment variable NODE_ENV: NODE_ENV=production node index.js However, this command only works on Linux.…
node.jsasked 4 years, 7 months ago Marcell Alves 2,453 -
1
votes2
answers65
viewsExpress JS Routing
I am new to using Express JS and would like to make a direction according to the session created, IE, according to the user profile, the application has an initial route "audit" and will have 2 user…
-
1
votes1
answer331
viewsBug multiples modals bootstrap
I have two modals on the same page, one to change and one to remove information from the bank. The code of the first modal is this: <!-- Modal Editar --> <div class="modal fade"…
-
1
votes1
answer203
viewsDo multiple requisitions or just one?
I am making an application in nodejs, where constantly it is necessary to consult information in the database, for example: name, description of items and etc... A similar site would be Netflix,…
-
1
votes2
answers1775
viewsHow to remove all elements from a javascript div?
How to remove all elements of a div at once removeChild() removes only one element?…
-
1
votes0
answers70
viewsLocalhost Cannot read Property 'route' of Undefined
I have an application that runs perfectly on herokuApp. But when it is in local application the build works but the dist folder has errors. The.log console shows the following 3 errors below. If…
-
1
votes0
answers65
viewsSyntaxerror: JSON.parse: Unexpected Character at line 1 column 1 of the JSON data - Nodejs vueJS
I am using an application with vuejs and Node, and I need to get information through a . json, but when making the request I get the following error: Syntaxerror: JSON.parse: Unexpected Character at…
-
1
votes0
answers171
viewsError: read ECONNRESET and Error: connect ETIMEDOUT
Good night, you guys. I’m doing scraping (web scraping) from a website, I’m using the Nodejs and Xios. When I run the application it works perfectly bringing me the information I requested, but it…
-
1
votes1
answer62
viewsWhat is the "done" function in Passport for?
I have begun to learn the local authentication form with passport-local, provided by Passport, and I was left with doubts regarding the usefulness of the function done within the authentication…
-
1
votes2
answers684
viewsHow to check if a directory is empty or if there is an existing file in the folder?
I would like to know how to check whether a directory (folder) is empty and whether a file already exists in it in Nodejs. Example: const fs = require("fs"); // recebeJson é a pasta que precisa ser…
-
1
votes0
answers153
viewsUse Promise when uploading files in Angular and Node.js
Good afternoon guys, I am with a registration form in homologation, but when I upload an image and a pdf file in the first moment my request returns that I have not filled all the data, but then…
-
1
votes1
answer219
viewsOperation of Array.filter() in Javascript
Hello! I am trying to generate an array with only a "result". Basically I do a query in Amazon that returns all calls made. I want to generate an array containing only the completed calls, which in…
-
1
votes1
answer183
viewsUnit Test - How to verify an expected error?
In a unit test for a module using Mocha and Chai need to check if an error is returned if the parameter format is invalid. The function of the module in question returns a Promise. The example below…
-
1
votes0
answers46
viewsWhen we use async don’t you need to use callback?
I have the following function in V10.6 nodejs: #func-1 module.exports.funcOne = (event, context, callback) => { callback(null, { message: 'funcOne', event }); }; #func-2 module.exports.funcTwo =…
-
1
votes1
answer36
viewsUse includes() in a filter()
The function below is rendering all user names, I need to include in it a way to filter the rendered users according to what is typed in an input text, I tried to use includes() but I’m not getting,…
-
1
votes1
answer880
viewsCompute Principal Diagonal Sum of a Javascript Matrix (Node)
I’m trying to calculate the main diagonal of an array in Js, someone could help ? function calcularDiagonal(matriz) { let soma = 0; for(let i = 0; i < matriz.length; i++) { for(let j = 0; j <…
-
1
votes2
answers256
viewsAdding a value to an object array with reduce
I have an array of objects that follow this format: [ { name: 'Batata', points: 23, }, { name: 'Pizza', points: 50, }, { name: 'Tacos', points: 60, }, ]; I want to go through this array and get the…
-
1
votes0
answers212
viewsDoubts of ACL with Node.js!
People I am trying to apply Authorization (ACL) using the plugin npm "node_acl" in a Node.js application with express, I am trying to implement as explained in the documentation.. however I am…
-
1
votes1
answer1126
viewsNode.js: How to extract database information and display in HTML pages
I have learned how to fetch information from Mysql database, but I cannot manipulate this data to expose in HTML pages. The code I’m going to expose underneath I got from w3school: var mysql =…
-
1
votes0
answers677
viewsError: Uncaught (in Promise): Typeerror: Cannot read Property 'name' of Undefined
You are generating this error by entering the page. Error: Uncaught (in Promise): Typeerror: Cannot read Property 'name' of Undefined Typeerror: Cannot read Property 'name' of Undefined at…
-
1
votes1
answer37
viewsReversing the display order with nodejs
Good? I would like to know how to reverse the order of display of bank items async index(req, res){ const docs = await Vag.find(); return res.json(docs); }, [ {item1}, {item2}, {item3} ] If so the…
-
1
votes0
answers56
viewsJWT and Passport returns 401 React
good afternoon. I am learning JWT and Passport and I am facing problems with the same, the problem is the following, I can log in and save in Localstorage, and redirect to another page however, even…
-
1
votes1
answer471
viewsreq.body nãp works on Express
I’m trying to read parameters sent via post, but the express only shows on the console.log empty objects. This is the code import * as jsonServer from 'json-server' import {Express} from "express";…
-
1
votes2
answers80
viewsEvent on 2 servers at the same time
I am programming a bot for my Discord servers and wanted the Guild Member Add event to run on two servers at once. const Discord = require('discord.js'); const { prefix } =…
-
1
votes2
answers438
viewsReturn the previous page after logging in
I set up a site where the user logs in by placing any Login and Password and storing it in Localstorage. Which part of the site he tries to access, always redirects to the Login page if he has not…
-
1
votes0
answers455
viewsVariable in the EJS
Good morning, everyone! So, come on: I’m trying to use Plotly to generate a bar graph, and it accepts variables. I have a connection on NODE.JS with a database and, NODE.JS in thesis (After a…
-
1
votes1
answer554
viewsHow to create a field that references a sub-array of a Collection in Mongoose?
Imagining the following structure(Merely illustrative example): Collection: Schools [ { "_id":"abc123", "nomeEscola":"escola1", "turmas":{ "_id":"ccc333", "nomeTurma":"Turma1" } }, { "_id":"abc122",…
-
1
votes1
answer137
viewsWhy use nodejs with asynchronous functions with AWS-Lambda?
AWS-Lambda services can be developed in Java, C#, Python, Go, Powershell and finally Nodejs (DOC). Nodejs is currently used as a backend of applications with the advantage of natively developing…
-
1
votes1
answer474
viewsShould I upload the package-lock.json file to github?
I know the folder node_modules should not be sent to the github, then add it to the file .gitignore... but what about the file package-lock.json q have a lot of information? It is safe to send it to…
-
1
votes1
answer95
viewsHow to access a given object within JSON via Axios
I want to get the data of product_id, product_name and product_price using Axios. { "status": "success", "url": { "https://api.exemplo.com/product-1": { "data": { "product_id": "1", "product_name":…
-
1
votes1
answer19
viewsContinuous Audio Transmission (Web Radio)
I wanted to make a Web radio on Node.JS + HTML + Javascript only that there are many problems, well, it was supposed to be like a Shoutcast/Icecast server only on Node.JS, and I tried, but it sends…
-
1
votes0
answers1993
viewsError: Cannot find module dotenv
I did the installation of modele as Dev: C:\Users\mrgen\OneDrive> npm i dotenv --save-dev npm WARN [email protected] No description npm WARN [email protected] No repository field. audited 299 packages…
-
1
votes1
answer30
viewsSum quantities in objects with identical properties
I’m doing a job and I came across a question that is apparently quite simple, but I’m not getting it. I need to do a reduce (or could be otherwise as well) to sum the quantity of items with the…
-
1
votes1
answer32
viewsitems Hidden by Filters - error console
I am creating an Electron application with angular2, where I make requests to an api. When disconnecting the machine from the internet, (because I want the application to work differently without…
-
1
votes1
answer306
viewsWhat is the best way to make a function of a "Node" file be called on my HTML5 site?
I’m doing a project of a simple music player using the Electronjs. For this I am using a library that plays MP3(play-sound) files, how can I call this function inside my HTML? I need to create…
-
1
votes0
answers91
viewsHow to use socket.io within a control that is injected by the consign?
I have my file server.js: const express = require( 'express' ); const expressValidator = require( 'express-validator' ); const expressSession = require( 'express-session' ); const consign = require(…
-
1
votes1
answer38
viewsHow to separate errors from a query in an expressjs api
What is the correct method to separate errors from a query? The current code compares the error manually with the message generated by mysql, in case the query may go wrong for several reasons,…
-
1
votes2
answers70
viewsError passing JSON arguments
I am trying to make an insertion in Mongodb passing some arguments in JSON: { "name": "TESTE", "category": "B", "service": "Novo processo", "description": "Novo Teste", "active": false,…
-
1
votes1
answer20
viewsI need to create a route that changes the project title with the id present in the route parameters. But when testing the route I get error 500
I need to create a route that changes the project title with the id present in the route parameters. But when testing the route I get error 500(Typeerror: Cannot set Property 'title' of Undefined)…
-
1
votes1
answer284
viewsConsuming API with Nodejs
I am developing as study projects an API that consumes data from the Google API. I want my API that receives various data from the Google API to provide only the City and State data for the…
-
1
votes0
answers30
viewsSocket.io. How to connect and upload user id
By default the socket.io generates a unique id. I need this id to be the same id as the user in the database. Have any way to set the id? if not, how my client front recovers the id generated by the…
-
1
votes2
answers2948
viewsNode-Sass is not recognized as an internal command
I’m trying to create a command for compile scss in css more easily. I followed this tutorial I installed nodejs, npm and Node-Sass I got into my project and ran the remote npm init My package.json…
-
1
votes0
answers18
viewsConvert AC3 audio to AAC with error using ffmpeg
I am trying to convert an ac3 audio of 1 hour and 16 minutes, this original audio is a 5.1, and I want to convert to aac, and it would have to be stereo as it would be reincarnated into an mp4 file…
-
1
votes1
answer460
viewsnodejs + Mongoose how do for one query need another?
I have two tables they have a link id being table A(Initial) tableB(dependencies) however there may be dependencies. I’d like you to just return in the dependency sequence. function Deps(dt) {…
-
1
votes1
answer54
viewsHow to compare only dates in Sequelize?
I am using ORM Sequelize and would like to compare only one date instead of the date with time. I have the following date: 2021-05-06 03:00:00.0000000 +00:00 And I’m doing like this: const dataAtual…