Questions tagged as 'node.js'

1
answer

How do I create a field that references a sub-array of a collection in mongoose?

Imagining the following structure (illustrative example only): Collection: Schools [ { "_id":"abc123", "nomeEscola":"escola1", "turmas":{ "_id":"ccc333", "nomeTurma":"Turma1" } }, {...
asked by 13.09.2018 / 14:18
1
answer

Function nodejs, operation

app.get('/', function(req, res){ res.send('Ola Mundo'); }); In case of this simple code just to illustrate we have a function in nodejs with 2 parameters the requisition and the answer, I wanted to know if someone can explain me better h...
asked by 12.04.2018 / 09:42
2
answers

Promises on NodeJS

I'm learning Node and getting a bit of asynchronous programming. To learn, I got the following example console.log("1"); setTimeout(function(){console.log("2");},3000); console.log("3"); setTimeout(function(){console.log("4");},1000);...
asked by 29.03.2018 / 05:09
1
answer

Difference setTimeout, setInterval, and setImmediate

What is the difference between setInterval , setTimeout and setImmediate in Node.JS? I know that setTimeout creates a single timer, like a delay, and setInterval creates a range. But what about setImmediat...
asked by 22.04.2018 / 15:47
1
answer

Error while running dockerfile

I have a dockerfile that runs an application on node.js FROM node RUN npm install mongoose RUN useradd --user-group --create-home --shell /bin/false app &&\ npm install --global [email protected] ENV HOME=/home/app COPY packag...
asked by 05.02.2018 / 20:35
1
answer

Search for Object Array value

I have the following code: jsonOptions = [{"description": "Carro 1", "product": "4"}, {"description": "Carro 2", "product": "5"}, {"description": "Carro 3", "product": "6"}, {"description": "Carr...
asked by 11.01.2018 / 20:32
1
answer

Can we develop a 100% JavaScript / HTML / CSS web application without backend?

I'm a backend Java developer and I've always used JavaScript in the frontend to give dynamism and better interaction with HTML pages (I've always developed corporate systems). Is there a way to develop a 100% enterprise system in JavaScript /...
asked by 13.01.2018 / 00:03
1
answer

Form with Node / EJS does not work!

Good morning, I'm doing a form, using Node and the EJS view engine, however I'm having trouble getting data from the forms in the controller. The return of the req.body is always undefined. app.js with body-parser app.use(bodyParser.json())...
asked by 05.01.2018 / 14:23
1
answer

Installation of dependencies in npm start but not finish

I am taking a course and following a book on NodeJs . In the book I'm asked to install the Express and Babel modules, already in the course they ask to install dependencies of an application that they make available. My problem is this:  ...
asked by 01.12.2017 / 22:56
1
answer

How do I receive a post or get request with typescript?

I'm starting with nodejs now and would like to use typescript to program compiling for pure javascript. So I'm having trouble finding something succinct so I can understand (since I'm a PHP programmer) how to receive post and get requests. For e...
asked by 20.11.2017 / 01:03