express Flashcards
1
Q
How do you add express to your package dependencies?
A
you use:
npm install express
2
Q
What Express application method starts the server and binds it to a network PORT?
A
app.listen(x)
x is the designated port
3
Q
What does the express.json() middleware do and when would you need it?
A
parse incoming request with json payloads.
it is used when the content type header matches content type
4
Q
What does express.static() return?
A
its a middleware function
5
Q
What is the local __dirname variable in a Node.js module?
A
it is the name of the directory that you are currently in
6
Q
What does the join() method of Node’s path module do?
A
it joins all given path segments methods together and returns it into a string.