Node.js Restart
![Build Status](https://img.shields.io/travis/kriasoft/restart.svg)
This module is designed to restart Node.js app in development mode, e.g. after compilation with
Babel/TypeScript is complete.
How to Install
$ npm install restart --save-dev
How to Use
build/app.js
const express = require('express');
const app = express();
let count = 0;
app.get('/', (req, res) => {
res.send(`count: ${++count}`);
});
module.exports = app.listen(8080);
server.js
if (process.env.NODE_ENV === 'production') {
require('./build/app');
} else {
const restart = require('restart');
const build = require('./scripts/build');
build({
watch: true,
onComplete: () => {
restart({ entry: './build/app' });
},
});
}
$ node ./server
License
Copyright (c) 2018-present Kriasoft | MIT License