express intro, get-json, delete, post-json Flashcards
How do you add express to your package dependencies?
Using the command:
npm install express
What Express application method starts the server and binds it to a network PORT?
app.listen()
Binds and listens for connections on the specified host and port. Identical to Node’s http.Server.listen()
How do you mount middleware with an Express application?
The use method of the app function
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?
Request and Response object
What is the appropriate Content-Type header for the HTTP messages that contain JSON in their bodies??
application/json
What is the significance of the HTTP request’s method?
It is a protocol which allows the fetching of resources
It allows us to get and use data
What does the express.json() middleware do and when would you need it?
It parses incoming requests with JSON payloads and is based on the body-parser
It’s used whenever the content type header matches the server