asotog
3/13/2020 - 3:29 PM

NodeJS Training Notes

Notes

VSCode debug options:

  • Simple debug giving entry script
  • Adding debug config to attach to existent npm script with restart: true for example "runtimeExecutable": "${workspaceFolder}/26-server/node_modules/.bin/nodemon", and "console": "integratedTerminal" or external terminal in order to quit process properly when you want to finish debugging

ExpressJS

  • middlewares have to call next function or res.send(...)
  • middlewares order matter
  • express does not parse request body by default that's why you have to attach a parser
  • templating support Pug(Jade) and EJS by default but also possible Handlebars with small configuration. With response.render('shop', { ... data }) template is used and data can be passed to dynamically render content