{"_id":"@bookmate/with-express-graceful-shutdown","_rev":"4-70e2e7111723573d4f46c20c720da5db","name":"@bookmate/with-express-graceful-shutdown","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@bookmate/with-express-graceful-shutdown","version":"0.0.1","description":"Decorator for Express apps to enable graceful shutdown","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/bookmate/with-express-graceful-shutdown.git"},"keywords":[],"author":"","license":"ISC","devDependencies":{"eslint":"5.13.0"},"gitHead":"45d6b0ba3a86cf4d5a9c9d64add9d7f789120446","bugs":{"url":"https://github.com/bookmate/with-express-graceful-shutdown/issues"},"homepage":"https://github.com/bookmate/with-express-graceful-shutdown#readme","_id":"@bookmate/with-express-graceful-shutdown@0.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.14.2","_npmUser":{"name":"azangru","email":"andrey.azov@gmail.com"},"dist":{"integrity":"sha512-KWd6xrPe+6Lw9NjvBR+wM0tMBbBUBUQeQXFfUied+3mW6/YZGEWFgNSEZpQq60X0oN8L9yIQnbXkU36ICrjHnA==","shasum":"038be54092c77558a91558d48d09eb61e550adbc","tarball":"https://registry.npmjs.org/@bookmate/with-express-graceful-shutdown/-/with-express-graceful-shutdown-0.0.1.tgz","fileCount":3,"unpackedSize":3908,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcWbq7CRA9TVsSAnZWagAATNEQAKCB+UfSUk+ztlL4vUFh\ntmIszH5QRAVI9lCaVOB/mi8htleaeqLxeqQnwsphxA/RJkO8VAZlTzuvagXp\nTKUmyX0m7r4QnMSZkWyhlSiJS8oSUFEC0RrrWlBfcUIi+nj6XWE9Wy8Bdtwo\nOgjhST52DDEkLOLihngFWpMYxv/pOo3xSFkfyrJBg20KehqZhCPv+K+1iNKM\n3Ky3PoTHtJGlD+JgEwD3WgrkP7HDb3Ys1GoJ6ug7tagZxbZwB7AqYEGNT5vQ\n+mWEjgJlZkuni4lGh/2da2VMk6WmgjtPIaUQi49mEEq+S9zBmTmTW+b8bVL9\nZSBGPUiSg6zc74BdK8/9RxSXTd4g7c0uBrUVdd5W50wsukei3om+roBUEgRb\nhjHXuaQCmbkXTE1clU8uYQTHfkcUoAGsvthpW1RWEXAs1QJCx7AzxRtbV8/A\neVn6ZqiuprTqgnrKoHyWMtY3L9c57APFmv76+sWJo4XEsGqc4Ydlr3TY5wRm\nx9Mgv63EKQR35cqsiPL0YNus8857NCg04GipOhJkaR64xZiEA1lwk+OHIX1G\nY+NJ22a8zAhLAQq+Gb0H9OQcxML4HiGtcYiAH1e0Itdu2Ibn3YdQ/BrtCkBd\nfjVWIilUTxgQ9DI0f2f5HePRgFnsofI56ifVlm9Nu3oVo7dYLR+6WgZvuPLW\nMh1u\r\n=K9oR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF7uLm8/khhYOzbZC+TnvlU5yjQdzt5silVFGr5imFOUAiBpJmKAwhHnMwrK/Rz4eOFy+I12eUDNYtAQgZ+aUf2R4A=="}]},"maintainers":[{"name":"panya","email":"panyakor@gmail.com"},{"name":"bookmate-npm","email":"npm@bookmate.com"},{"name":"azangru","email":"andrey.azov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/with-express-graceful-shutdown_0.0.1_1549384378415_0.5788518747405207"},"_hasShrinkwrap":false}},"time":{"created":"2019-02-05T16:32:58.237Z","0.0.1":"2019-02-05T16:32:58.559Z","modified":"2022-04-04T20:07:36.624Z"},"maintainers":[{"email":"andorn@gmail.com","name":"andorn"},{"email":"npm@bookmate.com","name":"bookmate-npm"}],"description":"Decorator for Express apps to enable graceful shutdown","homepage":"https://github.com/bookmate/with-express-graceful-shutdown#readme","keywords":[],"repository":{"type":"git","url":"git+https://github.com/bookmate/with-express-graceful-shutdown.git"},"bugs":{"url":"https://github.com/bookmate/with-express-graceful-shutdown/issues"},"license":"ISC","readme":"# Graceful Shutdown\n\n## Summary\nThis is a decorator for an Express http server enabling its graceful shutdown.\n\nBased on ideas from:\n\n1) [express-graceful-shutdown middleware](https://github.com/serby/express-graceful-shutdown), which in turn used [this blog post](http://blog.argteam.com/coding/hardening-node-js-for-production-part-3-zero-downtime-deployments-with-nginx) for inspiration;\n\n2) [http-shutdown module](https://github.com/thedillonb/http-shutdown)\n\n## Installation\n\n`npm install @bookmate/with-express-graceful-shutdown --save`\n\n## Usage\n\n```javascript\nconst withGracefulShutdown = require('@bookmate/with-express-graceful-shutdown');\nconst app = require('./app'); // a regular Express app\nconst logger = require('./logger') // a custom logger\n\nconst expressPort = 3000;\nconst forceTimout = 30 * 1000; // timeout after which the app should be shut down forcefully\n\nconst options = {\n  logger,\n  forceTimout\n}\n\nconst server = app.listen(expressPort, () => {\n  // your server is running\n});\n\nwithGracefulShutdown(server, options);\n```\n\n## Options\n\n- `logger`: a logger that provides `info`, `warn`, and `error` functions for recording graceful shutdown. Default: `console`.\n\n- `forceTimeout`: number of milliseconds to wait for server.close() to complete before calling process.exit(1). Default: 60000.\n","readmeFilename":"README.md"}