Pages

Wednesday, December 7, 2016

Building a Shared Calendar [Part 3]: Restart express.js server when a file changes using nodemon

Before adding any logic lets add the nodemon package to automatically restart the express.js server whenever a file changes. This will come in handy during development.

An npm script is added to call it:
{
  "name": "seattlelegalcalendar.com",
  "scripts": {
    "start": "node ./bin/www",
    "dev": "nodemon --watch routes ./bin/www"
  },
  "devDependencies": {
    "nodemon": "^1.10.2"
  }
}


Use the "--watch" parameter to pass the folders that you want to watch for changes. With this we are ready to add authentication on the next post.

Source code is available at bitbucket or you can play with the live test site.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.