express.js Flashcards
How do you add express to your package dependencies?
first npm init –yes then npm install/i express
What Express application method starts the server and binds it to a network PORT?
app.listen(PORT number, () => {
});
How do you mount a middleware with an Express application?
app.use((req, res) => {
});
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?
application/json
What is the significance of an HTTP request’s method?
it specifies which method to use
What does the express.json() middleware do and when would you need it?
you need it so that express.js can recognize the incoming Request Object as a JSON Object