Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import the Express module.
Express
const express = require([1]); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'nodemon' instead of 'express' in require.
Forgetting the quotes around the module name.
✗ Incorrect
To use Express, you import it with require("express").
2fill in blank
mediumComplete the script command to run the app with nodemon.
Express
"scripts": { "start": "node app.js", "dev": "[1] app.js" }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'node' instead of 'nodemon' for development reload.
Typing 'npm' or 'express' as the command.
✗ Incorrect
Use nodemon app.js to run the app with automatic reload on changes.
3fill in blank
hardFix the error in the nodemon config file to watch the correct folder.
Express
{
"watch": ["[1]"]
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Watching 'node_modules' which causes unnecessary reloads.
Watching 'dist' which is usually the build output.
✗ Incorrect
To reload on source code changes, nodemon should watch the src folder.
4fill in blank
hardFill both blanks to create a nodemon config that restarts on .js and .json changes.
Express
{
"ext": "[1]",
"ignore": ["[2]"]
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Including spaces in the extensions list.
Ignoring the wrong folders.
✗ Incorrect
Set ext to watch JavaScript and JSON files, and ignore node_modules folder.
5fill in blank
hardFill all three blanks to add a nodemon script, install command, and start command.
Express
{
"scripts": {
"[1]": "nodemon app.js",
"install": "npm install nodemon --save-dev",
"start": "node app.js"
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'start' instead of 'dev' for nodemon script.
Confusing 'nodemon' with 'npm' in scripts.
✗ Incorrect
The dev script runs nodemon, npm install installs nodemon, and nodemon is the command used.