Express Flashcards

1
Q

What is a client?

A

program or device that sends requests

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

what is a server?

A

program or device that receives requests from clients and sends back a response

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

HTTP method when. you visit a url

A

GET

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

first line of an HTTP request message?

A

The method protocol, target and version

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

first line of an HTTP response message?

A

protocol, version status code and status message

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

HTTP headers

A

metadata

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

is the body required for a valid HTTP message?

A

nope

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

what is NPM

A

NPM is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency conflicts intelligently.

npm consists of three distinct components:
• the website
• the Command Line Interface (CLI)
• the registry

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

What is a package in npm

A

files of. code and it includes a package.json

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

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
11
Q

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

A

something that your code depends on. You add by npm install

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

what happens when you install a dependency with npm?

A

adds another module in your directory and is assigned to the json file as a dependency

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

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

A

app.listen(path, [callback])

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

how to you mount a middleware with an Express application?

A

the use method

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

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

A

request and response objects

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

What is the appropriate content type header for HTTP messages that contain JSON in their bodies?

A

application/json

17
Q

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

A

if an incoming requisition message is application/json and the body is a string, it will parse the string

its needed for incoming request messages to parse bodies that are JSON

18
Q

what is the significance of an HTTP request message?

A

you can change and update data in your code and for communication purposes. it expresses what the client wants to do and the server responds accordingly

19
Q

What does express.static() return?

A

a function

20
Q

what is the local __dirname variable in a Node.js module?

A

the absolute path to the current directory.

21
Q

what does the join() method of Nodes path module do?

A

it joins strings to create a file path, putting slashes between them.