express-hello-world Flashcards
How do you mount a middleware with an Express application?
app.use method is used with arguments req and res -> mounts the specific middleware function/s at the specifies path and executes them when the base of the requested path matches path
this is basically an add event listener for a request
when there is a request to the server what do you want to do?
what is path??
- it’s default is ‘/’
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?
req and res
what does send() method do?
writes to the body of the response
how to customize http responses
methods like status or set, just make sure that you do it in order. you cannot change status code after you send the body.
what is the client asking for
do i have it ?