Node Flashcards
How do you mount a middleware with an Express application?
Call the method of the app object
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?
Request and response
What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?
application/json
What does the express.json() middleware do and when would you need it?
express.json() middleware is used to handle JSON request lines
What is Webpack?
A tool that lets you bundle your JavaScript applications and can be extended to support many different assets such as images, fonts and stylesheets
How do you add a devDependency to a package?
npm install –save-dev
What is an NPM script?
Convenient way to bundle common shell commands for projects
How do you execute Webpack with npm run?
Add a script to run webpack in the scripts objects of the package.json
“build”: “webpack”
npm run build
What does express.static( ) return?
express.static returns a middleware function that possibly sends the static files from its given parameter
What is the local __dirname variable in a Node.js module?
the absolute path to the directory name of the current module
What does the join( ) method of Node’s path module do?
joins all given path segments together and returns the result