3
I found myself with the problem of understanding in depth what res and req means in Node js, but it is necessary to understand the problem, I understand everything about what res is, and what req is and I know what to use them, but a function for example, Function soma(x, y) it takes the arguments x and y so that within its body it does the summing process and then we can use the result, OK!
But in the case of req e res, req is as in the name already says, a request, and the res is the answer to this, so in my head it makes no sense to receive the request and the answer.
The question is, how is this processed in the machine?
For the concept left to me is, I come to a bakery and I want salt bread, but first I have to ask if it has salt bread, but I already know it has salt bread, so I ask the baker and at the same time I give the answer to him, and then I keep waiting for him to answer me something I’ve already answered him.
At least that’s how it was understood, and I know it’s wrong.
I think I get it, the res is received in the function because it is an argument of the express, and then we manipulate the way we want to give the answer we want. Okay, thank you, thank you.
– David Ferrari