express-hello-world Flashcards

1
Q

How do you mount a middleware with an Express application?

A

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 ‘/’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?

A

req and res

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what does send() method do?

A

writes to the body of the response

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

how to customize http responses

A

methods like status or set, just make sure that you do it in order. you cannot change status code after you send the body.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
A

what is the client asking for
do i have it ?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly