express intro, get-json, delete, post-json Flashcards

1
Q

How do you add express to your package dependencies?

A

Using the command:

npm install express

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

What Express application method starts the server and binds it to a network PORT?

A

app.listen()

Binds and listens for connections on the specified host and port. Identical to Node’s http.Server.listen()

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

How do you mount middleware with an Express application?

A

The use method of the app function

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

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

A

Request and Response object

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

What is the appropriate Content-Type header for the HTTP messages that contain JSON in their bodies??

A

application/json

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

What is the significance of the HTTP request’s method?

A

It is a protocol which allows the fetching of resources

It allows us to get and use data

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

What does the express.json() middleware do and when would you need it?

A

It parses incoming requests with JSON payloads and is based on the body-parser

It’s used whenever the content type header matches the server

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