Questions tagged as 'nodejs'

1
answer

Use variable out of cycle for NodeJS

I am trying to fill an array using the 'push' function within a for loop, but calling the array out of the loop is still empty. They could help me understand how this part works. app.get('/ReturnStatus', function(request, response) { var c...
asked by 19.10.2018 / 21:05
1
answer

Promises with node.js

Hi, I have this problem with a node.js code. The idea of the code is to copy a file inside the server, but for some reason the file information is not transmidite as a parameter to the next promise. Here you have the code I hope you can help me:...
asked by 16.10.2018 / 02:39
2
answers

I get a json in a callback and I want to get the value of a property

How about I have the following code: function login(req, res){ req.getConnection((err, conexion)=>{ if(err) return next(err); conexion.query('select * from tabla where id=?', req.body.id, (err, dato)=>{ res.status(200)....
asked by 11.02.2018 / 20:39
4
answers

error install express

I have this problem, every time I try to install express in windows 10 with the command npm install express or npm install express-generator I get this error: npm WARN enoent ENOENT: no such file or directory, open 'C:\Users...
asked by 25.05.2017 / 15:08
1
answer

Practicing platzigram in Javascript

I'm doing the Platzigram project of Platzi_ to practice Javascript and so on. When using the package.json to automate tasks with <script> it does not work for me when I execute the npm start command and the gulp watch...
asked by 06.05.2017 / 21:54
3
answers

Problem receiving the Body in NodeJS from JavaScript

How do I send the fetch to the backend? onSubmit (e) { var random = stringGen(6); e.preventDefault(); let details = new FormData(); details.append('demo_id', random); details.append('descripti...
asked by 14.03.2017 / 18:04
1
answer

When to use clousures?

I have the following code: function creaSumador(x) { return function(y) { return x + y; }; } var suma5 = creaSumador(5); var suma10 = creaSumador(10); console.log(suma5(2)); // muestra 7 console.log(suma10(2)); // mu...
asked by 23.12.2016 / 21:29
2
answers

Destroy a JWT token

Good, does anyone know how it is possible to destroy a token in NodeJS? I'm pressing JWT to do a reset password, then I send a url to the user with a token, the system checks the token using jwt.verify() and if it is correct it performs t...
asked by 31.01.2017 / 22:44
2
answers

SyntaxError: missing) after argument list

transporter.sendMail(mailOptions, (error, info) { if (error) { return console.log(error); } console.log('Message %s sent: %s', info.messageId, info.response); }); Because that error comes out if the parenthe...
asked by 31.01.2017 / 19:21
1
answer

Problems with res.sendFile () express 4.14 Node.js 4.2

Good morning. I've been wrong for a couple of days. I'll let you know in case someone knows why it happens. I have a project AngularJS v1.5.11 + Node.js v4.2.6 (with express v4.14.1 ) and when I raise it with node serv...
asked by 08.02.2017 / 17:51