Node.js quick reference

Commands and Express essentials on one page.

CodePurpose
npm install nameAdd a package
npm install -D nameAdd a development-only package
npm run devRun a script from package.json
process.env.PORTRead an environment variable
req.params.idA value from the URL path
req.query.pageA value after ? in the URL
req.bodyParsed JSON from the request
res.json(x)Send JSON
res.status(404)Set the status code
app.use(fn)Add middleware
โ† Databases and securityNode.js & Express learning path โ†’