NPM Flashcards
What is NPM?
website, package registry, command line client
What is a package?
a directory of one or more files on it (reusable codes)
package json
How can you create a package.json with npm?
npm init –yes
What is a dependency and how do you add one to a package?
dependency -> piece of software that your software is going to need
npm install dependency_name
What happens when you add a dependency to a package with npm?
the dependency is added onto dependency list within the package.json
create node module folder
download the dependency onto the folder
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?
.use()
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?
req & res
What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?
JSON/application
What does the express.json() middleware do and when would you need it?
it parse incoming request (on its body) to JavaScript readable object
What is the significance of an HTTP request’s method?
define methods by server, & client expresses its intent.