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
answers559
viewsHow to use "import" properly in a Node.js application with typescript
Good afternoon. I am writing a Rest API using node.js and typescript, but I’m having trouble using the import in some parts of the programme. for example in my server.ts I have: const connectDB =…
-
1
votes2
answers612
viewsMysql + Nodejs, SELECT Return Undefined
I’m trying to return the SELECT Mysql to make a listing, however, when I give a return for the function to return the result of the SELECT, the variable in which I saved this data gets the value…
-
1
votes1
answer206
viewsHow to show number of pages in handlebars paging?
This is my code to calculate the number of pages, here is calculating everything correctly, already tested. app.get("/page/:page", (req, res) => { var perPage = 3 , page = Math.max(0,…
-
1
votes0
answers318
viewsHow to hide error message coming from an API using Ajax, Fetch or Axios
Good evening guys, I’m beginner with Javascript, and I’m developing the functionality of a CRUD, I want to use the correct HTTP verbs for each function (Obs: I know that using the HTTP verbs is only…
-
1
votes1
answer648
viewsAssociations with Node.JS / Sequelize
Good evening dear friends, I’m developing an API with Node.JS / Express / Sequelize and I need some help. As it is the first time that I use relational databases with Node, I don’t know exactly how…
-
1
votes1
answer1340
viewsSending body parameter via fetch API
I am trying to send a request asynchronously via javascript to the backend in Node, follow the front code: if ( window.location.pathname.indexOf('/') != - 1 ||…
-
1
votes0
answers81
viewsLoop with a pool.query pg(postgres) in the Ode, is giving conflict in the delivery of the Sponses
I’m a beginner in Node programming, I hope someone can help me, The problem is this, I am making an app with Node in which you have a for loop with the request body (req.body) and at each iteration…
-
1
votes1
answer599
viewsSchedule and cancel task in Node.JS (Node-cron, cron or Schedule)
I created a simple server with two routes, one to start a periodic service /job/start and another to cancel it /job/stop. Here’s the code: // framework const express = require('express'); const app…
-
1
votes2
answers446
viewsResponse.data returns empty array (React Nativ(HOOKS))
When you require something from the backend, the return comes as an empty array. I tried both with map and with console log.. Source code: Reportscreen.js const [reports, setReports ] =…
-
1
votes0
answers32
viewsMongoose Always returning an Empty array Nodejs
I’m using only find() on my server to Try to Retrieve data from Mongodb with Mongoose, but it retriveis this "{}", and on the console "Array(0) []" js router. const Teams = require('./models/map');…
-
1
votes2
answers58
viewsCreation of local server with express
I installed the framework express in my root folder with all projects on Node, so it was easy to import the modules in all projects. But when I try to start a local server, with the following scope:…
-
1
votes2
answers86
viewsproblems with this in Reactjs
The problem is this: I’m trying to build an accountant to practice mine React and an error occurred: this is undefined I created a state to hold the minutes and seconds: constructor(props) {…
-
1
votes2
answers973
viewsHow to export and import object array in Javascript?
I am creating a system, and within the main codes I have large arrays of objects that store information about products and information in which I use within the functions for certain system…
-
1
votes1
answer298
viewsHow to return the value of a query to the database in another javascript file?
I’m making an application where I need to query a database and return the value to another javascript file, only for some reason it’s not exporting anything to the other file when doing…
-
1
votes2
answers55
viewsGET request equivalent in separate files (controller and route)
Good night! Working on a project, and on the login screen after performing the authentication (Passportjs), the user will be redirected to the home page. However, a little while ago I started to…
-
1
votes1
answer173
viewsSearch username in a Query of the Mongoose-paginate
I am trying to do a user search field and for that I will receive via query param a variable search, which will contain the string search (in this case, the name (or part of a name) of one or more…
-
1
votes1
answer282
viewsUse React components methods on Hooks
Next people, I have a flat list in my React Native app, where in it I need to use a "ref" to access her "scrollToEnd()" method, but how I’m using Hooks I can’t use the ref. Here’s an example of what…
-
1
votes2
answers88
viewsDifficulty Deleting Cases in Javascript
I am starting to study Javascript and am developing a web application, in which an NGO register and can create cases. I’m using Insomnia to test HTTP requests. However, when trying to delete a case,…
-
1
votes1
answer66
viewsHow to synchronize script execution with asynchronous batch operation?
To illustrate the problem let’s go to a real scenario: I have to access something close to 450 directories shared in network to get the metadata of a given file, this data will be later compared…
node.jsasked 4 years, 6 months ago Fábio Jânio 3,407 -
1
votes1
answer56
viewsHow to call a function within function?
I’m developing a API, and in it I need to implement a method that seeks within my database a film through your ID. As I will use this method to perform more than one time, I would like to reuse it…
-
1
votes1
answer186
viewsHow can I inject a standard script into my HTML files using Node.js?
I am creating a server with Express in Node.js where each HTML page is different but has the same Javascript code on <head> of the document. What I want to do is write this Javascript code…
-
1
votes1
answer911
viewsRelationship between tables with Sequelize
I have two tables, one for Collaborator and one for Sector. A collaborator belongs to a sector and a sector contains several collaborators. I managed to create the tables, however, I don’t know how…
-
1
votes1
answer245
viewsGroup data with Sequelize and My SQL
Talk young, everything jewels with you? I need a help that is the following, I want to make returns the data to groups as follows id_categoria1: [ { id: 1, nome: "Arquivo tramitação 1", arquivo_url:…
-
1
votes1
answer106
viewsTrying to get data from the Mongodb bank
Guys I want to create a function that returns an array of my database collection, but I need to do this using mongoDB native drive, without Mongoose, I would like some tips. I already have a code,…
-
1
votes3
answers671
viewsConsume an API that requires authentication with Laravel
I’m creating an application with Laravel, which consists of consuming the Mcafee API. The previous version was built in pure php, from which it consumed the data of a Mysql database powered by a…
-
1
votes1
answer68
viewsTest error - Chai/Mocha
Hello! I’m studying unit trials with Chai and Mocha. I’ve never touched it before, but now I’m feeling the need to learn about it. I have the following code: module.exports = { //Create - Method…
-
1
votes0
answers90
viewsHow to create a KEY and IV for Crypto
Hi, I’m trying to make an AES-256-cbc encryption, and I’m having trouble creating a Key and an IV... I tried to use crypto.randomBytes(32) crypto.randomBytes(16) 32 to key, and 16 to IV. That way…
-
1
votes0
answers37
viewsWhat is the difference between HTTP server and HTTPS considering my structure?
I have a js Rest Node application running behind a proxy Reverse by Nginx, with https properly configured, where the server is configured as follows: Obs: app is my router. const httpServer =…
-
1
votes0
answers89
viewsHow to create editable text box over an image (e.g., as in Powerpoint)?
Hello, I’m developing a slide show like Power Point, only in the browser environment with Node.js (ejs, sequelize, etc.) I was able to create the inclusion part of the image and text by sending it…
-
1
votes1
answer932
viewsSyntaxerror: Private field '#attribute' must be declared in an enclosing class
I created the Employee and Director classes, being Employee Inheritor Manager(daughter), but when instantiating a Director object I got the following error: Syntaxerror: Private field '#bonus' must…
-
1
votes1
answer54
viewsMy inaccessible JSON key for Node.js validation
I am developing an API in Node.js and Knex.js, but I came across a problem, the array that Knex returns in the promise has a JSON inside and is numerical that needs to be validated. However, the key…
-
1
votes2
answers454
viewsError when creating a bank with Sequelize
Opa, I am creating a Rest API in Nodejs and using Sequelize as ORM only when I try to use the db:create command of the sequelize to create the database, it returns me this error: ERROR: Dialect…
-
1
votes1
answer702
viewsNodejs + Mysql + Return of Database Queries
Good afternoon! I’m having some problems with NODEJS using a Mysql database, I’ve made several attempts and I’m not sure how to solve this problem. My problem is that I would like to consume the…
-
1
votes1
answer103
viewsHow to access json Response fields in nodejs?
I’m studying a little bit about nodejs and am facing difficulties to capture and access json Sponse, For example: My Getbyid exports.getProduto = function(req, res) { const produtoId = req.params.id…
-
1
votes1
answer53
viewsArray is empty outside the function scope even though it is declared in the global scope
I’m starting in Javascript and Nodejs and I’m not able to understand pq even I declare an array in the global scope, when I try to access it outside the functions where I made the map the array…
-
1
votes1
answer158
viewsReceive Nodejs post form returns Undefined
I am learning socket.io developing a chat and etc. What happens is that on the login page I am creating I am not being able to receive input data. <!DOCTYPE html> <html lang="pt-br">…
-
1
votes1
answer589
viewsEntity mapping Many to Many with typeorm
What I want to do is a list of all the objects that are related by the ID to an entity. In this project, a group has several users and one user belongs to several groups. Group entity:…
-
1
votes1
answer80
viewsHow to connect a Electron Nodejs window to a proxy?
I have the following code in Js on Node, using Electron: const {app, BrowserWindow} = require('electron') app.on('ready', function(){ mainWindow = new BrowserWindow();…
-
1
votes3
answers1423
viewsuseState does not update - Reactjs
I’m starting in the world of Reactjs. I have a front that is consuming a tracking API, so it returns me an object with status, responseMessage and Object, an array of objects. I do the…
-
1
votes1
answer139
viewsTo configure the resolution of modules in the tsconfig.json file to use the ts-Node library in Typescript
Hello, I am creating an API in typescript and the structure of my project is as follows:: api | - src | - index.ts | - server.ts | - package.json | - tsconfig.json Within api/src/server.ts I have a…
-
1
votes0
answers90
viewsError while trying to create a Node.Js symlink
I am trying to run the creation of a symbolic link on Node.Js however, I am getting error 'EPERM' when running the script. Script: const fs = require('fs'); const path = require('path'); let…
-
1
votes2
answers228
viewsSeparating elements from an array for sequelize query
This id_message I send by parameter by my request, a console.log in this returns me the value of the image. const id_mensagem = [...new Set(response.data.map(mensagens => mensagens.id_mensagem))]…
-
1
votes0
answers261
viewsDisplay result of a query in an HTML tab. NODE.JS/SQL SERVER
Hello, I need urgent help. I made a connection to the sql server database via Node.js Only to know the amount of items you have in the table (Count). I would like to show this quantity result in a…
-
1
votes2
answers375
viewsTypescript override
I want to add a property user for the Express request. For this I created a file called express.d.ts with the following content: declare namespace Express { export interface Request { user: { id:…
-
1
votes1
answer62
viewsError sending email with Sendgrid in Nodejs
I have the following structure to send emails by SendGrid: import mail from '@sendgrid/mail'; function send(email_data) { mail.setApiKey(process.env.SENDGRID_API_KEY); const message = { to:…
-
1
votes2
answers636
viewsReturn of a Knex query using . map
Good afternoon, you guys. I have a Controller that receives data from a frontend spreadsheet, read the dice and play these to run a query in the database, so my intention is to play the results back…
-
1
votes1
answer22
viewsCheck if the value of an object of a certain class has been changed
I want when one value is changed within one object of a certain class, another to change as well. Example: class minhaClasse{ constructor(valor1, valor2){ this.valor1 = valor1 this.valor2 = valor2…
-
1
votes0
answers32
viewsError with nodejs/authentication/middleware
I’m having a problem logging in to the blog, the problem is: when trying to log in the first time with a user 0 (without being admin) it keeps loading the page and goes nowhere, but after I click on…
node.jsasked 4 years, 2 months ago André Cabral 87 -
1
votes1
answer361
viewsStreaming videos with Nodejs
Good morning! I have a REST API running on Node with Express, and the frontend running Vuejs. The API returns me a list with the name of some videos that were previously stored in an Storage, and a…
-
1
votes2
answers216
viewsExpress - req.body does not find the data sent by the customer
I have a small form with login and password whose data I need to be sent to a route X via POST. For this, I used AJAX and to make sure that the data was being sent, I used the Success function to…