2.0.0 • Published 6 years ago

restart v2.0.0

Weekly downloads
50
License
MIT
Repository
github
Last release
6 years ago

Node.js Restart

NPM version NPM downloads Build Status

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') {
  // In a production environment launch the Node.js app directly.
  require('./build/app');
} else {
  // Otherwise, start building the app from source and
  // restart it upon new changes in the /build folder.
  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

2.0.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

1.0.0-beta.2

6 years ago

1.0.0-beta.1

6 years ago

0.1.0

6 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

11 years ago

0.0.0

11 years ago