HTTP / npm Flashcards
What is a client?
The devices calling to a server for a service or files.
What is a server?
A device that holds the information/service the clients require.
It can be accessed via the internet
Which HTTP method does a browser issue to a web server when you visit a URL?
GET - only requesting information
What three things are on the start-line of an HTTP request message?
The method (GET, PUT, PUSH …or… HEAD, OPTIONS )
The target (usually a URL)
The http version
What three things are on the start-line of an HTTP response message?
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”
What are HTTP headers?
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”
Is a body required for a valid HTTP request or response message?
No, a body is optional.
They are usually used when a client needs to push something to the server.
What is NPM?
A software registry where people can share software Consists of three parts: 1) the website 2) the Command Line Interface (CLI) 3) the registry
What is a package?
A package is a directory you can download, which has some functionality you can use in your own code.
How can you create a package.json with npm?
Run the following command:
npm init –yes
What is a dependency and how do you add one to a package?
npm install packageName
What happens when you add a dependency to a package with npm?
You can now require/import the package into your JS code
The dependency appears on your package.json file
How do you add express to your package dependencies?
Install it
npm install express
What Express application method starts the server and binds it to a network PORT?
The listen method
appName.listen(portNumber , callbackFunction { console.log(“this is live on port 3000”) })