Express Flashcards

1
Q

What is NPM?

A

a package manager where programmers can share their codes

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

What is a package?

A

a list of modules (package json file)

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

How can you create a package.json with npm?

A

npm init – yes

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

What is a dependency and how to you add one to a package?

A

dependency is package that is added to

npm install ____

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

What happens when you add a dependency to a package with npm?

A

node-module is added to directory and dded to dependencies

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
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
7
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
8
Q

How do you mount a middleware with an Express application?

A

use()

middleware is processing of requesting and responding

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

requires()

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

application/json
send() ->JSON.stringify variable and array only
json() ->JSON.stringify variable, array, boolean, null

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

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

A

automatically parse the json data when the client requests

app.use(express.json())

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

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

A

path
ex: app.delete(‘path’ , (req, res) => {
})
path = ‘/api/grades/:id’ -> req.params.id

typing after path in command line -> req.body

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