Express Flashcards

1
Q

What is Express useful for?

A

It helps manage servers and routes/end-points

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

Serves as a middle man for front and back end

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 dependancies?

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

listen()

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

What do port numbers refer to?

A

Specific port numbers are often used to identify specific services.

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

What is Express middleware?

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

What is Express middleware useful for?

A

It is useful for carrying out actions for a request coming in and a response going out

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

How do you mount a middleware with an Express application?

A

app.use()

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

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

A

err, req, res, next

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

Whats does app.use do?

A

Installs the middle ware

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

What is an API endpoint?

A

A URL (uniform resource locator)

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

What is he appropriate Content-Type header for HTTP messages that JSON

A

application/json

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

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

A

Lets you know what you’re doing

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

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

A

express.json() method is used to parse the incoming requests with JSON payloads

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

What is the purpose of the Express Static middleware?

A

To add middleware for serving static files to your Express app

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

What does express.static( ) return?

A

It returns a middleware function

17
Q

What are several examples of static files?

A

images, javascript, css, html, react , …. any text-like file (anything file that gets sent to the client that doesn’t change)

18
Q

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

A

Use the express.static built-in middleware function