E
E
error5022020-06-07 21:04:36
Node.js
error502, 2020-06-07 21:04:36

How does Express server work?

How does the server work? Does index.js start over from the beginning on each user request and the whole server goes through the code again or only at the beginning of the session?
Architecture below(Node, Express, Mongoose)
5edd2b4149772400736103.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
McBernar, 2020-06-07
@McBernar

The index runs once.
Then requests are tracked and they are already executed each time anew.
If you put some value into a variable in the index and change it in the routes, then this value will be common for all routes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question