Node part 2 Flashcards
What is a client?
the one that makes service requests
What is a server?
the one that provides a resource or service
Which HTTP method does a browser issue to a web server when you visit a URL?
Get request
What is on the first line of an HTTP request message?
Their start-line contain three elements:
HTTP Method (get, post, put),
Request Target: (URL),
HTTP Version
What is on the first line of an HTTP response message?
Status line:{ Protocol Version, Status code, Status Text }
What are HTTP headers?
List of key value pairs in the header of the response
Is a body required for a valid HTTP message?
No
What is NPM?
a package manager for JavaScript: website, command line interface, and registry:
to shared data and packages, etc.
What is a package?
- a folder containing a package.json program that lists the your projects dependencies
- specifies versions of packages
- makes your build reproducible, to share with other devs
(directory with one or more files, and a package.json file)
How can you create a package.json with npm?
use the npm init command in the root directory of package
What is a dependency and how do you add one to a package?
packages that your project depends on,
you can list them as “dependencies” in package.json
What happens when you add a dependency to a package with npm?
the project will install all listed dependencies with the install command
How do you add express to your package dependencies?
it will be added when you use npm install express
What Express application method starts the server and binds it to a network PORT?
listen()
How do you mount a middleware with an Express application?
app.use() / app.METHOD() ?