Questions tagged as 'nodejs'

2
answers

Send a string as a file using request in Node

I have a String and I want to convert it to a stream to send it as if it were a file via multipart of request . I want to do it in the air, without generating the file on disk. I'm doing it this way: const stream = requi...
asked by 15.03.2017 / 17:54
2
answers

Update array in React

Having the following code, this.state = { valores: ['A', 'B', 'C'] } How could I update an element in this array? Of the type: this.setState({ valores[1]: 'a' })     
asked by 24.11.2016 / 19:27
2
answers

replace values in symbols in a string

I have the following string: Var text='¡Hola $var1$! Gracias $var2$' How can I replace what is between $ by the value of the variable. Example: var1="Juan", var2="Pedro" Resultado='¡Hola Juan! Gracias Pedro' The text can have more var...
asked by 11.07.2017 / 16:47
3
answers

What is the difference between REST and RESTful?

I understand that they are architectures and that the idea of these is once downloaded the web page this does not re-download any HTML or CSS or JS if not, that only makes calls or requests and is answered with JSON     
asked by 13.01.2016 / 23:15
1
answer

Run php script and send arguments from node.js

I have a PHP script that receives 3 arguments to insert into a database php app.php "Arg1" "Arg2" "Arg3" When I run it from console I can do it without any problem, to call it from my node.js script I try with: var exec = require("child_p...
asked by 02.10.2018 / 02:01
1
answer

Print in Node.js

Good night, I'm new here, I hope not to commit any infractions and be of help, I tell them that I'm dealing with the impression in Node.js, the need is to create a software in node.js and run it directly on the computer where I will have connect...
asked by 15.04.2017 / 09:21
1
answer

Json Web Token (JWT) in Node.js with express

I am working with the Javascript Json Web Token library, where I create the token with the function: var token = jwt.sign({data: 'foobar', 'secret', { expiresIn: 60 * 60 }); To verify my usage token, the function: jwt.verify(token, 'shh...
asked by 13.07.2018 / 21:15
2
answers

Learning promises, does not execute sequentially

I am learning promises , and I was doing some examples. This is my code in which I intend to show.    the following: // one, two, three, four but instead shows   asynchronously // one, four, two, three let promise =new Promise(function...
asked by 30.10.2016 / 17:01
2
answers

How to recover all the GridFs files in MongoDB?

I have saved files in Mongodb using GridFs and C # but now I need to recover ALL the files I have saved in my database and store them in a folder. I hope you can advise me a little. Thanks This is the Code as I keep my files var connectionS...
asked by 22.11.2016 / 16:25
1
answer

Write in a txt file

What I want is to add "a line of text" every time the code is executed. However what I get is to replace all the content of the txt. I leave my code here. const fs = require("fs"); let ruta = './log.txt' let texto = "Esto es una prueba \n\t";...
asked by 21.12.2018 / 16:52