express Flashcards

1
Q

What is Express useful for?

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

How does Express fit into a full-stack web application?

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

How do you add express to your package dependencies?

A

npm install express

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

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

A

the app.listen method and port is often used to identify specific services.

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

What is Express middleware?

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

What is Express middleware useful for?

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

How do you mount a middleware with an Express application?

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

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

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

What is an API endpoint?

A

what you send in the request path it’s everything after the colon

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

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

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

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

A

it tells you what you are doing with the information

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

Is a server required to do a request?

A

NO, it’s all convention

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

Where does express and node fit in the three tier architecture?

A

in the backend or server

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

What does the function app.get do?

A

it checks if the path matches (or endpoint) and if so it runs the function app.use

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

What does app.use mean?

A

it mounts a middleware function

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

When does express run the middleware?

A

when the path runs through the network port

17
Q

What is the middleware?

A

app.use is a callback function or middleware they are the same thing

18
Q

If there are multiple middleware, do they all execute?

A

only if they call next( ) if not the chain ends. if there are no response it sends an error.

19
Q

What is the difference between app.use and app.get?

A

app.get is a structured call that uses app.use

20
Q

What is the difference between res.send, res.json and res.sendStatus?

A

res.send is the general one, res.json JSON stringifies the data and calls res. send to send out the data, and res.sendStatus sends the status code.

21
Q

What is the purpose of the Express Static middleware?

A
22
Q

What does express.static() return?

A

it returns a middleware function

23
Q

What are several examples of static files?

A

images, css files, html files, json files, basically anything where it treated like a read file

24
Q

What is a good way to serve application images using Express?

A

using express.static