HTTP / npm Flashcards

1
Q

What is a client?

A

The devices calling to a server for a service or files.

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

What is a server?

A

A device that holds the information/service the clients require.

It can be accessed via the internet

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

Which HTTP method does a browser issue to a web server when you visit a URL?

A

GET - only requesting information

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

What three things are on the start-line of an HTTP request message?

A

The method (GET, PUT, PUSH …or… HEAD, OPTIONS )

The target (usually a URL)

The http version

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

What three things are on the start-line of an HTTP response message?

A

The HTTP version (usually HTTP/1.1 )

A status code, indicating if the request was a success of failure (examples: 200, 404, 302)

A status text, a human-friendly version of the status result (example: “Not Fount”)

The full status line may look like this: “HTTML/1.1 404 Not Found”

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

What are HTTP headers?

A

They are one line on the HTTP requests or responses which allow clients and servers to pass additional information in their request/response.

They consist of the “name: then the value of the response”

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

Is a body required for a valid HTTP request or response message?

A

No, a body is optional.

They are usually used when a client needs to push something to the server.

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

What is NPM?

A
A software registry where people can share software
Consists of three parts:
1) the website
2) the Command Line Interface (CLI)
3) the registry
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a package?

A

A package is a directory you can download, which has some functionality you can use in your own code.

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

How can you create a package.json with npm?

A

Run the following command:

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 do you add one to a package?

A

npm install packageName

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

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

A

You can now require/import the package into your JS code

The dependency appears on your package.json file

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

How do you add express to your package dependencies?

A

Install it

npm install express

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

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

A

The listen method

appName.listen(portNumber , callbackFunction { console.log(“this is live on port 3000”) })

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