Question

I've built an application using the Locomotive.JS MVC framework for node (locomotive is built upon express) , i wanted know how to start this application using nodemon??

Was it helpful?

Solution

Looking at this blog post, if you don't already have a server.js, you need to create one to run your application, in order to use nodemon.

In the project directory, create a server.js file:

var locomotive = require('locomotive'),
        env = process.env.NODE_ENV || 'development',
        port = process.env.PORT || 3000,
        address = '0.0.0.0';

locomotive.boot(__dirname, env, function(err, server) {
    if (err) { throw err; }
    server.listen(port, address, function() {
      var addr = this.address();
      console.log('listening on %s:%d', addr.address, addr.port);
    });
});

Then simply run:

nodemon server.js
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top