Package Exports
- @ladjs/graceful
- @ladjs/graceful/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@ladjs/graceful) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@ladjs/graceful
Gracefully exit server (Koa), database (Mongo/Mongoose), Redis clients, Bree job schedulers, Bull job schedulers, and custom handlers.
Table of Contents
Install
npm:
npm install @ladjs/gracefulyarn:
yarn add @ladjs/gracefulUsage
Using this package will bind process event listeners when graceful.listen() is called:
process.on('warning')- will output viaconfig.logger.warnprocess.on('unhandledRejection')- will output viaconfig.logger.errorprocess.once('uncaughtException')- will output viaconfig.logger.errorandprocess.exit(1)(does not exit gracefully)process.on('message')- support Windows (e.g. signals not available) and listen for message ofshutdownand then exit gracefullyprocess.once('SIGTERM')- will exit gracefullyprocess.once('SIGHUP')- will exit gracefullyprocess.once('SIGINT')- will exit gracefullyprocess.once('SIGUSR2')- will exit gracefully (nodemon support)
This package also prevents multiple process/SIG events from triggering multiple graceful exits. Only one graceful exit can occur at a time.
See one of these following files from Lad for the most up to date usage example:
- API - https://github.com/ladjs/lad/blob/master/template/api.js
- Web - https://github.com/ladjs/lad/blob/master/template/web.js
- Bull - https://github.com/ladjs/lad/blob/master/template/bull.js
- Proxy - https://github.com/ladjs/lad/blob/master/template/proxy.js
You can also read more about Bree at https://github.com/breejs/bree.
Contributors
| Name | Website |
|---|---|
| Nick Baugh | http://niftylettuce.com/ |
| Felix Mosheev | https://github.com/felixmosh |
| Nicholai Nissen | https://nicholai.dev |