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
-
0
votes1
answer689
viewsInsert values from a variable into the database with nodejs, mysql and sequelize
I’m trying to input into the database the contents of the variables: token and now. The respective fields in the table users of the bank are: passwordResetToken and passwordResetExpires. I can…
-
0
votes2
answers383
viewsHow to export and use a Local Middleware with Express Route?
I’m having two difficulties which are: 1) I’m trying to export and use mine middleware to be used locally. 2) I would also like to know if it is possible to use a middleware for a specific request…
-
0
votes1
answer61
viewsHow to use a const with middleware and Routes?
I have the following const in my file Routes.js: const database = []; For learning purposes I’m using it as if it were my own "database", where according to the type of request I handle this…
-
0
votes1
answer132
viewsDoubt in Javascript + Sqlite3, return of Select
Hello, I need to retrieve information from a bank and display on a table. I’m using Electron and sqlite3. I have this function to do the consultation. function getTable(){ var obj = []; var aux =…
-
0
votes0
answers105
viewsUnit tests with JEST, on Node.Js, without using module.Exports in Javascript code files
With both files below (ePar.js and ePar.test.js) in the same folder, how to perform the unit test, with the JEST, via Node.Js, of function ePar (in the archive ePar.js) WITHOUT ALTERING THE SAME? I…
-
0
votes2
answers497
viewsCheck Box is not unchecking when clicked again - React Native
I have a code with 3 Checkbox and when pressed it does not uncheck... Another remark, as I would for when the "UE/HQB" is selected and the others stay disabled={true} or by first selecting any of…
-
0
votes1
answer61
viewsError registering user in database with Nodejs + React Native
I’m not getting past the values I put in TextInput for the data set. When I click the button for the object to be sent to DB, the object sent will be empty, this is the answer of console.log: Object…
-
0
votes2
answers187
viewsNodejs query in SQL Server with Like
I’m starting some routines with Node.js and sqlserver. My Coldfusion routine is a materials query and calls the Node api via cfhttp. I need to pass as a parameter to the API two or more fields to be…
-
0
votes1
answer88
viewsVariable does not change in nodejs
I am developing a Node application for Guardhouse Communication (API) and I am having trouble changing the value of a variable. follows below the code: var net = require("net"); var express =…
-
0
votes1
answer104
viewsNodejs - Make an algorithm that reads the height and enrollment of ten students. Show the enrollment of the highest student and the lowest student
All I can do is show the height from the smallest to the largest, but I want to show you which license plates the heights belong to (undergraduate enrollment, higher student enrollment, etc) const…
-
0
votes1
answer177
viewsAggregate array of two or more collections in mongodb
Hello, I have two Collections and want to query the two Collections, like the sql "Join". The relation between the Collections is made as follows: medico: [{ medicoId: { type:…
-
0
votes0
answers386
viewsProblems passing Query String as parameter in nodejs
I’m trying to make the functionality of login in the Nodejs, for this I created a method get who receives the email and the password as Query String and performs a query in the database (MySQL)…
-
0
votes1
answer528
viewsMysql - Cannot add or update a Child Row: a Foreign key Constraint fails (`areas_knowledge`. `sub_areas`,
Hello, I am doing a job that consists in developing a system to manage projects and etc. In this system I need to have a table with the knowledge areas of cnpq. I’m taking the Grande Areas, Areas,…
-
0
votes1
answer63
viewsQUERY ERROR sequelize Association LEFT OUTER JOIN API NODEJS
I have the following SQL command: select u.name_user, a.type_administrator from users u inner join administrators a on u.id_user = a.id_administrator; and I need to turn this into my API into Nodejs…
-
0
votes0
answers93
viewsSearch record in two tables with nodejs and mysql
I’m using the NodeJS and Mysql and I need to show in my post listing form. These I search in the table "posts", but in the category item, the category id appears. How do I search for the category…
-
0
votes0
answers74
viewsnodejs Doubt about module.Exports
Good evening. I have a question maybe a little bit simple but that is keeping me up at night and I think I’m doing it the wrong way. However, if someone can correct me and explain why I made a…
-
0
votes1
answer57
viewsSend task from server to clients nodejs
I am using socket.io and making a server and client in nodejs. The communication between them is working. Server receives notification when client connects and disconnects. I am now needing to send…
-
0
votes0
answers37
viewsgo through the map array and find the letters
I am developing a nodejs application with cron job and I need to pass the task by input configuration to the task. So I thought of a pattern to put in this input, example: 10S:3M:2H:1D:6Y:2W 10S:3M…
-
0
votes1
answer44
viewsPromise Node js
I make 3 HTTPS nodejs requests to an API also in Node, each Promise performs a task and these Promises I am passing several information on their body, one of these information needs to be an ID.…
-
0
votes0
answers18
viewsNodejs - initialize variables and they are available throughout the project
I’m having the following difficulty: I have the following design structure: my server.js is the start of the project. However, within the services, models, etc I have some libs, as an example log…
-
0
votes2
answers860
viewsNestjs with Typeorm for Mysql - Nodejs
I’m starting in the area so sorry if it’s something silly. I started developing a server using Nestjs with Typeorm to connect to a Mysql database but am picking up the following error: 'No…
-
0
votes2
answers109
viewsDo not redirect form - nodejs
I have a form where I send requests POST pro nodejs save in the database but when I send the information it is redirected to the route and I receive the res…
-
0
votes1
answer40
viewsNodejs ler json time series line by line
Access an API, which predicts future values, the API returns me the JSON below: { series: { '2020-02-13': '62.5000', '2020-02-14': '64.5800', '2020-02-15': '30.7700', '2020-02-16': '60.8700',…
-
0
votes1
answer107
viewsUndefined for the body of a request
I’m trying to create a Postings in Node, where a post will have the following fields : Category, title and Description. The entity responsible for making this feature is called posts, which is…
-
0
votes1
answer133
viewsVariable Node.js takes Undefined value
I am trying to pick up the answer of an API, within the function body receives the JSON but outside the function the value is set to Undefined async function getJSON(){ var options = { url:…
-
0
votes1
answer16
viewsChange byte value in nodes
In php to change the value of certain bytes in the binary file, use a simple replace. For example: $acc = fread($f5900xt, filesize(public_path("5900xt"))); $demoid = substr($acc, 0, $userlenght);…
-
0
votes1
answer921
viewsCreate a loading(spinner) in an asynchronous request with React
I have an application with the front in React and the back with Node, and I needed that the moment the user pressed the button, the loading appeared and then the request was performed, or while the…
-
0
votes0
answers31
viewsPassing a Function with parameters in HTML
Aoba, what is it? I’m trying to make a delete in my backend be called in HTML when a person clicks on a certain button. Then I’m passing a src script, to the file that has this Function. And in…
-
0
votes1
answer66
viewsSend Ajax POST to another port?
I am making a website with pure PHP/JS, but I need to use the services of Google Calendar API and wanted to use them with Node. My Node server is running on port 3333 and PHP on 80. I tried to use…
-
0
votes1
answer2080
viewsNode and Mysql connection error in Docker Compose: Error: connect ECONNREFUSED
I created a file docker-compose.yml to load a Mysql database and a Nodejs server: version: '3' services: database: image: mysql:5.7 container_name: 'database' restart: 'always' volumes: -…
-
0
votes1
answer321
viewscompose a POST type request using a PROMISE function
I am a python programmer and I am programming now in javascript with Nodejs, I am already able to program normally but a doubt that is not letting me progress in the language is the issue of the…
-
0
votes1
answer692
viewsPage with Nodejs with Mysql database
I’m creating a API to then be consumed in React. In this API you will have a route(page) that will list database users. I applied the rules and I’m testing in India, which by the way is working…
-
0
votes2
answers72
viewsMongoose’s Findone method is running in infinite loop
I have the following problem. I have a Findone method to search if a user exists in the database, according to the user and password. But when I run the method - using Inuit, it ends up in an…
-
0
votes1
answer166
viewsRecover Json Data with Javascript
I am retrieving a Json by Node/Axios and receive the following structure (A and B). I have 2 occurrences of establishments. RESULT TO { statuscod: 200, mensagem: null, dados:…
-
0
votes1
answer82
viewsHow to calculate hours via reduce?
So I have a little doubt about doing the calculation of hours using reduce, because until the stage where I left I can return the hours in normal format and now I need to do the sum of them I…
-
0
votes0
answers345
viewsHow to save picture blob with multer in nodejs
Well I have this table: And I have this code that I get an image by the woman in the nodejs: routes.post('/salvarImagem', upload.single('Img') , (req, res) => { const connection =…
-
0
votes2
answers362
viewsIs it possible to block access to a middleware route?
Guys, I have a public folder with all the "public" files from my site html,css,js etc. And another folder called private with all the file private files connected with database and etc, which is a…
-
0
votes1
answer31
viewsHow do I updateItem an element nested in Dynamodb?
I have a Map format structure stored in Dynamodb, and would like to add another attribute within the school object, something like: { name: 'Felipe' uid: 112233, data: { structure: { school: { name:…
-
0
votes1
answer226
viewsProblem when creating Many to Many association using Sequelize (belongsToMany)
I am getting the following error when defining a Many to Many association between two tables: C:\eadfabet\node_modules\sequelize\lib\associations\mixin.js:49 throw new…
-
0
votes1
answer66
viewsNode.js processes are not being closed
I was studying React (I used the command npx create-react-app) but I closed the prompt I typed the command npm start. When I saw the files on my computer, there were more than 20 Node processes. I…
-
0
votes1
answer49
viewsI want to know how to remove hyphens (-), and (|) from the table below to return a json from the table
let arquivo = fs.readFileSync('meu_txt.txt','utf8') let cells_arquivo = arquivo.split('\r\n').map(function(el) { return el.split(/[|]/) }) let headings_arquivo = cells_arquivo.shift() let…
-
0
votes1
answer204
viewsSequelize error: [...]. belongsToMany([...]) requires through option, pass either a string or a model
I’m importing models using the autoloader (index.js) of the sequelize. An Accesslevel model has a relationship with the Menu model (N: N), through the Accesslevelhasmenu model. What should happen?…
-
0
votes1
answer40
viewsWhat is the correct way to use AWS Iot.describeCertificate()? I cannot access the function asynchronously
I need to regain the status of an AWS-Iot-Core certificate using a Lambda function with Nodejs. According to the official documentation would need to use the function describeCertificate(). This is…
-
0
votes1
answer58
viewsCreating a like with Node.js and mongodb
I’m creating a like where the action can be done only once per person, I perform the action with the user X the first time and it works and if he tries again he can’t, but when someone else gives…
-
0
votes0
answers34
viewsSingle port being disputed by multiple customers
I am developing a solution for consuming a condominium box API in Nodejs, using the net library to make the communication. Our application makes direct communication with the condominium hardware…
node.jsasked 4 years, 5 months ago lucas menezes 89 -
0
votes1
answer320
viewsDifference between Formdata and form
These days I was trying to upload data contained in a form. I used Node and React stack-like. The form contained the following fields: product, description, cost, quantity, image(file type). I used…
-
0
votes0
answers53
viewsMysql & Node - Error: ER_NOT_SUPPORTED_AUTH_MODE
When I try to login to my site, I get the error: ER_NOT_SUPPORTED_AUTH_MODE From what I’ve seen I think it has to do with the database connection, which is not correct. var pool = mysql.createPool({…
-
0
votes1
answer25
viewsMysql - Cross-table information (Selects)
I am trying to make a table that presents a set of elements, where if a given id is in another table, then that element cannot be in the first. Albums | id1 | id2 (Foreign Key)| Capas| id2 |…
-
0
votes1
answer228
viewsSequelize db:migrate error
Hello! I have a DB Postgres running perfectly on my machine. I can create my Migrations, for example in the following command: npx sequelize migration:create --name=create-users I am trying to run a…
-
0
votes0
answers16
viewsMysql - Added Password Generated Separately
I’m trying to insert Customers but with a password that is generated by a code but I’m not quite sure how to implement the use of this. site.get("/processa_InsereCliente", function (req, res) { //…