Express Intro, Middleware, Get/Delete/Post JSON Flashcards
How do you add express to your package dependencies?
Npm install express
What Express application method starts the server and binds it to a network PORT?
app.listen(path, [callback])
How do you mount a middleware with an Express application?
By app.use()
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?
Request object, response object
What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?
Application/json
What is the significance of an HTTP request’s method?
Is arbitrary. It makes it more specific for the client to show the server what the client is wants to do.
What does the express.json() middleware do and when would you need it?
It parses the incoming requests object.
It is needed when you need to parse the request bodies that are JSON.