toa-pm
Process events manager for toa.
toa
Example
Demo 1, with defaultHandle
:
const Toa = const pm = const app = app app
Demo 2:
const Toa = const pm = const app = app app
Demo 3:
const Toa = const pm = const app = app app
Installation
npm install toa-pm
API
const pm =
pm(app[, handle])
It will add handle
to process
's message
event, or add one more event-handle
to process
. ** Use it after app.listen
**
-
app
: Toa application. -
handle
: {Function|Object}, if omithandle
, the default handle will be used:{if message === 'shutdown'thisserver}Default handle accept a 'shutdown' message to stop from accepting new connections and keeps existing connections. The server is finally closed and exit gracefully when all connections are ended. For example:
pm2 gracefulReload app
License
The MIT License (MIT)