{"_id":"express-graceful-exit","_rev":"24-fea8aa466a1f0805aa6c14ede246dbd9","name":"express-graceful-exit","description":"Allow graceful exits for express apps, supporting zero downtime deploys","dist-tags":{"latest":"0.5.2","beta-0.5.x":"0.5.0-rc.2"},"versions":{"0.0.1":{"name":"express-graceful-exit","version":"0.0.1","description":"Allow express to support graceful exits to achieve zero downtime deploys","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/mathrawka/express-graceful-exit.git"},"homepage":"https://github.com/mathrawka/express-graceful-exit","author":{"name":"Jon Keating","email":"jon@licq.org"},"license":"MIT","dependencies":{"underscore":"~1.4.4"},"_id":"express-graceful-exit@0.0.1","dist":{"shasum":"e1ceeac1b65aa4ca431c32f79cbbcb68e555d70e","tarball":"https://registry.npmjs.org/express-graceful-exit/-/express-graceful-exit-0.0.1.tgz","integrity":"sha512-L7G+Skm/qh7KdEzMBObafjyjV7305DadSoBYZI/owcJvwM0OTfBQHFkgmXTTj7U3kpL2V7ZyOxlkRvYHCOnnlw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHY7FlmC0l9P5BMD1fyXOh7mg4dMdr/tWIPkjRIjlcczAiEA0FlI/4IL9xyD8Jx2M/YGN6hp1gOCfPe0Vfcmv3K40qY="}]},"_from":".","_npmVersion":"1.2.2","_npmUser":{"name":"mathrawka","email":"jon@licq.org"},"maintainers":[{"name":"mathrawka","email":"jon@licq.org"}],"directories":{}},"0.0.2":{"name":"express-graceful-exit","version":"0.0.2","description":"Allow express to support graceful exits to achieve zero downtime deploys","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/mathrawka/express-graceful-exit.git"},"homepage":"https://github.com/mathrawka/express-graceful-exit","author":{"name":"Jon Keating","email":"jon@licq.org"},"license":"MIT","dependencies":{"underscore":"~1.4.4"},"_id":"express-graceful-exit@0.0.2","dist":{"shasum":"850368c181b81e029c675c1e9f9f8709b782ffd8","tarball":"https://registry.npmjs.org/express-graceful-exit/-/express-graceful-exit-0.0.2.tgz","integrity":"sha512-aGF4fKbhDrvSMLDdjg7IQH537/+L0/tdNzUIm7Z15P23l1J6dBQQspklyHfreefPYVDHXufUcUSiRWYERuvaZg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFwSfMVISEWMqO1UKjm5MyycIsaqbj6dE0ghTBA4QPE3AiEAnL6SvIhgQXNpspY1ROL+KGLsTtI2nXk9ZuXij9TYNrs="}]},"_from":".","_npmVersion":"1.2.2","_npmUser":{"name":"mathrawka","email":"jon@licq.org"},"maintainers":[{"name":"mathrawka","email":"jon@licq.org"}],"directories":{}},"0.1.0":{"name":"express-graceful-exit","version":"0.1.0","description":"Allow express to support graceful exits to achieve zero downtime deploys","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/mathrawka/express-graceful-exit.git"},"homepage":"https://github.com/mathrawka/express-graceful-exit","author":{"name":"Jon Keating","email":"jon@licq.org"},"license":"MIT","dependencies":{"underscore":"~1.4.4"},"_id":"express-graceful-exit@0.1.0","dist":{"shasum":"3d004cb8ee4f408648ec9e4a112469d8158308fc","tarball":"https://registry.npmjs.org/express-graceful-exit/-/express-graceful-exit-0.1.0.tgz","integrity":"sha512-c+q28rv1LKETkr+PMg82qG64IFdmGKQiSGKKTQ3Gmzsd3K441Qtw7xgAUsaRdGxfbOSpjdl3+k6kY54OIWLURQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGxdB1V5IR5LRlHa+5fOKPcTb85rxJw+ycdgaKCU7/NNAiEAk/Frz/AluaDgXQ1h6xuHBT8cvQ7GWRky3dEWdD2ZW10="}]},"_from":".","_npmVersion":"1.2.2","_npmUser":{"name":"mathrawka","email":"jon@licq.org"},"maintainers":[{"name":"mathrawka","email":"jon@licq.org"}],"directories":{}},"0.2.1":{"name":"express-graceful-exit","version":"0.2.1","description":"Allow graceful exits for express apps, supporting zero downtime deploys","keywords":["express","graceful","exit","shutdown","clean","tidy"],"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/mathrawka/express-graceful-exit.git"},"homepage":"https://github.com/mathrawka/express-graceful-exit","author":{"name":"Jon Keating","email":"jon@licq.org"},"contributors":[{"name":"Ivo Havener","email":"ivolucien@gmail.com"}],"license":"MIT","dependencies":{"underscore":"^1.4.4"},"gitHead":"e661806f92a1ee0e112c61562237890e2221099e","bugs":{"url":"https://github.com/mathrawka/express-graceful-exit/issues"},"_id":"express-graceful-exit@0.2.1","_shasum":"023bd7d1659efde2e73293c4e763129d7d46d0c9","_from":".","_npmVersion":"2.0.2","_nodeVersion":"0.10.36","_npmUser":{"name":"ivolucien","email":"ivolucien@gmail.com"},"dist":{"shasum":"023bd7d1659efde2e73293c4e763129d7d46d0c9","tarball":"https://registry.npmjs.org/express-graceful-exit/-/express-graceful-exit-0.2.1.tgz","integrity":"sha512-9Uoh6908TNQ7ujKty1ZtW9djGGLcROHlpcIjZjTVg+eV0Sdxes37F58eynFCynPbuq99t5Vbg5aqNmBkQ0Z6Ug==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFcX4dh8Tb8uxv8goJwkY900ubB1iCW8Ns3WuU0yy2MSAiEApAUnxAgr4ZPwoiFON2bHPl12juUYX9xO4vBFX5inNwY="}]},"maintainers":[{"name":"ivolucien","email":"ivolucien@gmail.com"},{"name":"mathrawka","email":"jon@licq.org"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/express-graceful-exit-0.2.1.tgz_1469654945924_0.5423753678333014"},"directories":{}},"0.3.0":{"name":"express-graceful-exit","version":"0.3.0","description":"Allow graceful exits for express apps, supporting zero downtime deploys","keywords":["express","graceful","exit","shutdown","clean","tidy"],"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/mathrawka/express-graceful-exit.git"},"homepage":"https://github.com/mathrawka/express-graceful-exit","author":{"name":"Jon Keating","email":"jon@licq.org"},"contributors":[{"name":"Ivo Havener","email":"ivolucien@gmail.com"}],"license":"MIT","dependencies":{"underscore":"^1.4.4"},"gitHead":"65d41365e605a5b9e44e62a26db0851725a41b81","bugs":{"url":"https://github.com/mathrawka/express-graceful-exit/issues"},"_id":"express-graceful-exit@0.3.0","_shasum":"3966dd93cbdaf701de05899861188d3294a8d8c6","_from":".","_npmVersion":"2.0.2","_nodeVersion":"0.10.36","_npmUser":{"name":"ivolucien","email":"ivolucien@gmail.com"},"dist":{"shasum":"3966dd93cbdaf701de05899861188d3294a8d8c6","tarball":"https://registry.npmjs.org/express-graceful-exit/-/express-graceful-exit-0.3.0.tgz","integrity":"sha512-uDdu7SSaPoEAdA6x2pSfYZj4BRl4AjKlWMhkBUORa+wAq6egjuk1UoTw/BamtUrWv4AY3ynZXcFX/0qb8mrD+A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCAtvg8Xw0QOEStuQ9TAY35fnFzpeno21IyssjUTCv7+QIhAOQr3CAF8Xy6i+xUeWQilavqhTkncH3xOeDdBHqNzCzI"}]},"maintainers":[{"name":"ivolucien","email":"ivolucien@gmail.com"},{"name":"mathrawka","email":"jon@licq.org"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/express-graceful-exit-0.3.0.tgz_1470416632127_0.8716430757194757"},"directories":{}},"0.3.3":{"name":"express-graceful-exit","version":"0.3.3","description":"Allow graceful exits for express apps, supporting zero downtime deploys","keywords":["express","graceful","exit","shutdown","clean","tidy"],"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/mathrawka/express-graceful-exit.git"},"homepage":"https://github.com/mathrawka/express-graceful-exit","author":{"name":"Jon Keating","email":"jon@licq.org"},"contributors":[{"name":"Ivo Havener","email":"ivolucien@gmail.com"}],"license":"MIT","dependencies":{"underscore":"^1.4.4"},"gitHead":"4e8160763f2d219982b8b045973d2334f13d4524","bugs":{"url":"https://github.com/mathrawka/express-graceful-exit/issues"},"_id":"express-graceful-exit@0.3.3","_shasum":"6a0dcbfba571e4ff35496d5a9e8aba4d7ca9b1c1","_from":".","_npmVersion":"2.0.2","_nodeVersion":"0.10.36","_npmUser":{"name":"ivolucien","email":"ivolucien@gmail.com"},"dist":{"shasum":"6a0dcbfba571e4ff35496d5a9e8aba4d7ca9b1c1","tarball":"https://registry.npmjs.org/express-graceful-exit/-/express-graceful-exit-0.3.3.tgz","integrity":"sha512-uL/WjPFSclrEz8zXP4UGpWUGdaP5zNxUvgmJgy3qkXT7uGYGiVCi4RhxrjUro8MjaoovNLk7k90v4u6XBZNvug==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD/DX2uzO/gDHIVnf92xqiTezqfj2H4Jl0KIZgIme1mIAIgV23GYsUq0pBZo6vJrdlqjdaDNb/sYn+vrUqT9AjkpwI="}]},"maintainers":[{"name":"ivolucien","email":"ivolucien@gmail.com"},{"name":"mathrawka","email":"jon@licq.org"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/express-graceful-exit-0.3.3.tgz_1470426440911_0.17748268600553274"},"directories":{}},"0.4.0":{"name":"express-graceful-exit","version":"0.4.0","description":"Allow graceful exits for express apps, supporting zero downtime deploys","keywords":["express","graceful","exit","shutdown","clean","tidy"],"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/mathrawka/express-graceful-exit.git"},"homepage":"https://github.com/mathrawka/express-graceful-exit","author":{"name":"Jon Keating","email":"jon@licq.org"},"contributors":[{"name":"Ivo Havener","email":"ivolucien@gmail.com"}],"license":"MIT","dependencies":{"underscore":"^1.4.4"},"gitHead":"5e1e60de7afff96d6f3d34c0bf8cc77f1f6404c6","bugs":{"url":"https://github.com/mathrawka/express-graceful-exit/issues"},"_id":"express-graceful-exit@0.4.0","_shasum":"c0143cc698f9dbd0f1284a1ca2433f049f83c4f3","_from":".","_npmVersion":"2.15.11","_nodeVersion":"4.7.0","_npmUser":{"name":"ivolucien","email":"ivolucien@gmail.com"},"dist":{"shasum":"c0143cc698f9dbd0f1284a1ca2433f049f83c4f3","tarball":"https://registry.npmjs.org/express-graceful-exit/-/express-graceful-exit-0.4.0.tgz","integrity":"sha512-eelHdQKp9GP33TPcKl7o2918T47J3xgIUgfXxQ3FpbZIWtoM+UBypm6ad1VbWMX/MluCJmC9o2r4XHQSp3x11Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCO1lr3aJWILOAiuqwy1GlV0EF7PdMJ19gWse7tzsDUFwIhAKTSxIirSWP+grbHgmcgiqXUp+bMwuOztXHPdlCdIE3r"}]},"maintainers":[{"name":"ivolucien","email":"ivolucien@gmail.com"},{"name":"mathrawka","email":"jon@licq.org"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/express-graceful-exit-0.4.0.tgz_1492731413861_0.13684232253581285"},"directories":{}},"0.4.1":{"name":"express-graceful-exit","version":"0.4.1","description":"Allow graceful exits for express apps, supporting zero downtime deploys","keywords":["express","graceful","exit","shutdown","clean","tidy"],"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/mathrawka/express-graceful-exit.git"},"homepage":"https://github.com/mathrawka/express-graceful-exit","author":{"name":"Jon Keating","email":"jon@licq.org"},"contributors":[{"name":"Ivo Havener","email":"ivolucien@gmail.com"}],"license":"MIT","dependencies":{"underscore":"^1.4.4"},"gitHead":"221714cff40bfb891dd375b07348374906c96514","bugs":{"url":"https://github.com/mathrawka/express-graceful-exit/issues"},"_id":"express-graceful-exit@0.4.1","_shasum":"d636911b896f7d8f833c7ad9a489bdfc06932f78","_from":".","_npmVersion":"2.15.11","_nodeVersion":"4.8.3","_npmUser":{"name":"ivolucien","email":"ivolucien@gmail.com"},"dist":{"shasum":"d636911b896f7d8f833c7ad9a489bdfc06932f78","tarball":"https://registry.npmjs.org/express-graceful-exit/-/express-graceful-exit-0.4.1.tgz","integrity":"sha512-JBM3Z3+AssJ8kkmRE2UO1iSVCim/CcPPydbAM7HmjRT5Qa+EKbjbEaCqQ3VnarVO1p9JKVapDgciwK59dgupEw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDV3XvBAABbVa1ReKYIa1CBoUwDp/YKRDQROjxdy2R9RgIhAPuyhXGfPIt3ABXh3hzzGC83IdQtXqsk1EVnTITbcWiG"}]},"maintainers":[{"name":"ivolucien","email":"ivolucien@gmail.com"},{"name":"mathrawka","email":"jon@licq.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/express-graceful-exit-0.4.1.tgz_1516052387703_0.6547383305151016"},"directories":{}},"0.4.2":{"name":"express-graceful-exit","version":"0.4.2","description":"Allow graceful exits for express apps, supporting zero downtime deploys","keywords":["express","graceful","exit","shutdown","clean","tidy"],"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/mathrawka/express-graceful-exit.git"},"homepage":"https://github.com/mathrawka/express-graceful-exit","author":{"name":"Jon Keating","email":"jon@licq.org"},"contributors":[{"name":"Ivo Havener","email":"ivolucien@gmail.com"}],"license":"MIT","dependencies":{"underscore":"^1.4.4"},"gitHead":"4a642b57f46563aa8c41d518ff4358009c7095b9","bugs":{"url":"https://github.com/mathrawka/express-graceful-exit/issues"},"_id":"express-graceful-exit@0.4.2","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"ivolucien","email":"ivolucien@gmail.com"},"dist":{"integrity":"sha512-PnthAUxsSryGgasjjfcJ94N4R4oxIX84E4Y9NiZ2vPSZJ8md6OiYl8YPpyigbc0aeiOiAtO3r488ZEMU3jeu0g==","shasum":"7b6a2fd4ff461a688e346648275afe5955589e5d","tarball":"https://registry.npmjs.org/express-graceful-exit/-/express-graceful-exit-0.4.2.tgz","fileCount":6,"unpackedSize":12076,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbvWkCCRA9TVsSAnZWagAAQ/UP/2tPTTl4FliLo8Bse9cB\n1fTdFhmLAx4WaJiIcxirczSQ+vMhGZaEn20X1NUEsRA4r2ACbvF4h7XUnsT+\nRH4yCiV2GLzmC+EaPdnjYMCiXzlm+MNTl4c96oZjOB9QtUAWLvV/nZizLj/K\nXMtIqvQd8Bt44eJmPHj8zlx/hOzo9aUSQev5GzdDpFd+oDfuKbdtuZ6wEmme\n+AbNFdnHTZvxalQyUS/wMdSbyA4eptWtigv+iTNXWmb3WgTo94vgvxEpr86l\nr3ptVIfRyTZ2khPpqa56oDgOjr9XpnY19PUgQWJyIf1KrE6/aK+R5ujeuKux\nJg3Y+iXnl5TAanKFUAdSxPY5r73qsKkrf7KYu18V/lv3mCMnPdt/WlVuh8VE\nwLMxWgSMcpFAQLokY/DiGxz0RxGjzblx0ZYMVP39jhIazwqNXRMuHvXzHeKb\nLDgUDLGPlmZHmqQBa8/n6JMU18zScncDZ1WJffl3gg+DxYYLUHk+8o5gYBmV\nCBulQmAgWb61Ky8+Lytzw7JYmXU/aylxzwAS5kQ7O4iK/uAURjkXOnpIJXVJ\nnWWJEIJW5S/qiRQXhp25QAYpvRlsn0p5JK0DSv8FnTRpDHHqh9vXNYxSfv+c\nx5i9yXdkKu6HJCjfehoy1botcjo1PPRlV8aYz1uhEatbOjCfXKYnZNEgHL9X\nurmK\r\n=lswd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDdnpYkSUiyU8Pu5tufTO9mFmT+VvCeHyf4UqI8Y9C2YAiEA0/Uq7m9bXr0kQgbskA7l2KjECUmXAGDT4OEQMcTswKM="}]},"maintainers":[{"name":"ivolucien","email":"ivolucien@gmail.com"},{"name":"mathrawka","email":"jon@licq.org"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/express-graceful-exit_0.4.2_1539139842318_0.7270407540294932"},"_hasShrinkwrap":false},"0.5.0-rc.1":{"name":"express-graceful-exit","version":"0.5.0-rc.1","description":"Allow graceful exits for express apps, supporting zero downtime deploys","keywords":["express","graceful","exit","shutdown","clean","tidy"],"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/mathrawka/express-graceful-exit.git"},"homepage":"https://github.com/mathrawka/express-graceful-exit","author":{"name":"Jon Keating","email":"jon@licq.org"},"contributors":[{"name":"Ivo Havener","email":"ivolucien@gmail.com"}],"license":"MIT","dependencies":{"underscore":"^1.4.4"},"readme":"# express-graceful-exit\n\nGracefully decline new requests while shutting down your application. A component that helps support zero downtime deploys for Node.js with [Express](http://expressjs.com/).\n\nThe project was originally developed for Express v3.X, but is used in production with Express v4.X. Please write up an issue or submit a PR if you find bugs using express-graceful-exit with Express v4.X and higher.\n\n## Installation\n\n```` bash\n$ cd /path/to/your/project\n$ npm install express-graceful-exit\n````\n\n## Compatibility\n\nv0.X.X versions are backwards API compatible, with these minor behavior changes:\n1. Process exit is called in a `setTimeout` block from v0.2.0 forward, so the timing is slightly different between v0.1.0 to v0.2.x+.\n2. After exit was triggered, incoming requests were mismanaged prior to v0.5.0. <br> As of v0.5.0 incoming requests are dropped cleanly by default, with new options such as responding with a custom error and/or performing one last request per connection.\n\n## Usage\n\nThe following two components must both be used to enable clean server shutdown, where incoming requests are gracefully declined.\n\nThere are multiple exit options for how in-flight requests are handled, ranging from forced exist after a specified deadline to waiting indefinitely for processing to complete.\n\n### middleware\n\nThis middleware should be the very first middleware that gets setup with your Express app.\n\n```` javascript\nvar express = require('express');\nvar app = express();\nvar gracefulExit = require('express-graceful-exit');\n\nvar server = app.listen(port)\n\ngracefulExit.init(server) // use init() if configured to exit the process after timeout\napp.use(gracefulExit.middleware(app));\n````\n\n### gracefulExitHandler\n\nThis function tells express to accept no new requests and gracefully closes the http server. It can be attached to a signal, or used as a normal function call if another tool is used (such as [naught](https://github.com/indabamusic/naught)).\n\n```` javascript\n// Example for naught\nprocess.on('message', function(message) {\n  if (message === 'shutdown') {\n    gracefulExit.gracefulExitHandler(app, server, {\n        <see options below>\n    });\n  }\n});\n````\n\n## Options\n\n### Middleware\n\nThere are no options available currently.\n\n### Exit Handler\n\nThe following options are available:\n\n Option              |  Description                                     |  Default\n :------------------ |  :---------------------------------------------- |  :-------\n __log__             |  Print status messages and errors to the logger  |  false\n __logger__          |  Function that accepts a string to output a log message  |  console.log\n __callback__        |  Optional function that is called with the exit status code once express has shutdown, gracefully or not <br> Use in conjunction with  `exitProcess: false` when the caller handles process shutdown  |  no-op\n __performLastRequest__ |  Process the first request received per connection after exit starts, and include a connection close header for callers and load balancers. <br> `false` is the existing behavior, deprecated as of v0.5.0 |  false\n __errorDuringExit__ |  Respond to incoming requests with an error instead of silently dropping them. <br> `false` is the existing behavior, deprecated as of v0.5.0  |  false\n __getRejectionError__  |  Function returning rejection error for incoming requests during graceful exit | `function () { return new Error('Server unavailable, no new requests accepted during shutdown') }`\n __exitProcess__      |  If true, the module calls `process.exit()` when express has shutdown, gracefully or not  |  true\n __exitDelay__       |  Wait timer duration in the final internal callback (triggered either by gracefulExitHandler or the hard exit handler) if `exitProcess: true`  |  10ms\n  __suicideTimeout__ |  How long to wait before giving up on graceful shutdown, then returns exit code of 1  |  2m 10s (130s)\n __socketio__        |  An instance of `socket.io`, used to close all open connections after timeout  |  none\n __force__           |  Instructs the module to forcibly close sockets once the suicide timeout elapses. <br> For this option to work you must call `gracefulExit.init(server)` when initializing the HTTP server  |  false\n\n## Details\n\nTo gracefully exit this module does the following things:\n\n1. Closes the http server so no new connections are accepted\n2. Sets connection close header for Keep-Alive connections, if configured for responses</br> The HTTP status code of 502 is returned, so nginx, ELB, etc will try with an active server</br> If `errorDuringExit` and/or `performLastRequest` are set to true, a response is sent with a `Connection: close` header\n3. If a socket.io instance is passed in the options, all connected clients are immediately disconnected (socket.io v0.X through v1.4.x support)</br> The client should have code to reconnect on disconnect\n4. Once the server fully disconnects or the hard exit timer runs\n    1. If all in-flight requests have resolved and/or disconnected, the exit handler returns `0`\n    2. OR if any connections remain after `suicideTimeout` ms, the handler returns `1`\n5. In either case, if exitProcess is set to true the hard exit handler waits exitDelay ms and calls `process.exit(x)`, this allows the logger time to flush and the app's callback to complete, if any\n\n## Zero Downtime Deploys\n\nThis module does not give you zero downtime deploys on its own. It enables the http server to exit gracefully, which when used with a module like naught can provide zero downtime deploys.\n\n#### Author: [Jon Keating](http://twitter.com/emostar)\nThis module was originally developed for Frafty (formerly www.frafty.com), a Daily Fantasy Sports site.\n#### Maintainer: [Ivo Havener](https://github.com/ivolucien)\n\n","readmeFilename":"README.md","gitHead":"7315ef37d743dee824885ab20d97bcd389e4c6dc","bugs":{"url":"https://github.com/mathrawka/express-graceful-exit/issues"},"_id":"express-graceful-exit@0.5.0-rc.1","_nodeVersion":"12.8.0","_npmVersion":"6.8.0","dist":{"integrity":"sha512-Oc1wzydefNALjeXYhv0j79aK6QYiI7NWKaT6vZi8LuVSneOrc+UYehOjzi+NxlXeqpyV9CKrZ97XDfYdcMEs2Q==","shasum":"edf843a3aff8c44cd9cd7f1120c098bba545bee3","tarball":"https://registry.npmjs.org/express-graceful-exit/-/express-graceful-exit-0.5.0-rc.1.tgz","fileCount":6,"unpackedSize":15729,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdpfTiCRA9TVsSAnZWagAA1f8P/A2JbfcLow8bv4LZ8ISw\nK8lA5cPLg8GdZjAmGTFfV8b7AYhUc4XraCCuSW6tnrQ9XN8psOkBz+xHQoww\ntE6KUIxr4aVJOotDIP44qdVIHgf6LMBe1/ZbdDT2qsGSFxUgVJ6/UvFnN0hJ\nIw80sbJvFPaNF54CLXtNLO7geMzZ3eBfayz6IsBYU6bZ/1MdTJD8nqI6RPW2\nkT9IJae7wY3Vetfm11m2AQ5heKTrcbQryJXUT6CzlnxGkDR0tSzRRSkcpc0A\nklhW+HGhgb75gvMKLcAPiVSuf5COk5GlZk9Z8JgrWA0jngvweme64IV75GRt\nNxTgdqY/Ar84MQvwXS1HHWyuonFsm+vD/BI7WQe5JFrnskRIROHuD/QR5Kia\nNLbmDhO8nksrlF3jKiEDmwAAxJfQ5qVLTz8UPlmXmaskiL3WtOHiHmyrPIUL\nlm65yEMB1QPc1G/UyVNwkuwSlVSp1X1JBfUmlYGBO1L/w/0aQrXurNdA140m\n12FK4bD++1LutYbjkT4ByG1ffOH2YrW8koK5m6+VOmE6BZPK8I1yxhs129CC\n8hM4u8tvs+BFHLX1AA7zKC5J9GO4Xq5VKqORStnP8h5unA4myzAsLjduhQRb\nXVrTJfwiDTl/OYpJSq02DOwhwFAuX7Q4ws4uNqDTR5wF2BsWM56U4sr3m8lU\niXlB\r\n=hZqf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICFiL9E3vEmpShOpJZ+ADIiho6wXgqekKbgYMmydr6ZqAiEA66f7F8ZtcGSTYA+dZqBtA/2z8vCZs6p6/booiexCOnc="}]},"maintainers":[{"name":"ivolucien","email":"ivolucien@gmail.com"},{"name":"mathrawka","email":"jon@licq.org"}],"_npmUser":{"name":"ivolucien","email":"ivolucien@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/express-graceful-exit_0.5.0-rc.1_1571157218061_0.8083422261591193"},"_hasShrinkwrap":false},"0.5.0-rc.2":{"name":"express-graceful-exit","version":"0.5.0-rc.2","description":"Allow graceful exits for express apps, supporting zero downtime deploys","keywords":["express","graceful","exit","shutdown","clean","tidy"],"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/mathrawka/express-graceful-exit.git"},"homepage":"https://github.com/mathrawka/express-graceful-exit","author":{"name":"Jon Keating","email":"jon@licq.org"},"contributors":[{"name":"Ivo Havener","email":"ivolucien@gmail.com"}],"license":"MIT","dependencies":{"underscore":"^1.4.4"},"readme":"# express-graceful-exit\n\nGracefully decline new requests while shutting down your application. A component that helps support zero downtime deploys for Node.js with [Express](http://expressjs.com/).\n\nThe project was originally developed for Express v3.X, but is used in production with Express v4.X. Please write up an issue or submit a PR if you find bugs using express-graceful-exit with Express v4.X and higher.\n\n## Installation\n\n```` bash\n$ cd /path/to/your/project\n$ npm install express-graceful-exit\n````\n\n## Compatibility\n\nv0.X.X versions are backwards API compatible, with these minor behavior changes:\n1. Process exit is called in a `setTimeout` block from v0.2.0 forward, so the timing is slightly different between v0.1.0 to v0.2.x+.\n2. After exit was triggered, incoming requests were mismanaged prior to v0.5.0. <br> As of v0.5.0 incoming requests are dropped cleanly by default, with new options such as responding with a custom error and/or performing one last request per connection.\n\n## Usage\n\nThe following two components must both be used to enable clean server shutdown, where incoming requests are gracefully declined.\n\nThere are multiple exit options for how in-flight requests are handled, ranging from forced exist after a specified deadline to waiting indefinitely for processing to complete.\n\n### middleware\n\nThis middleware should be the very first middleware that gets setup with your Express app.\n\n```` javascript\nvar express = require('express');\nvar app = express();\nvar gracefulExit = require('express-graceful-exit');\n\nvar server = app.listen(port)\n\ngracefulExit.init(server) // use init() if configured to exit the process after timeout\napp.use(gracefulExit.middleware(app));\n````\n\n### gracefulExitHandler\n\nThis function tells express to accept no new requests and gracefully closes the http server. It can be attached to a signal, or used as a normal function call if another tool is used (such as [naught](https://github.com/indabamusic/naught)).\n\n```` javascript\n// Example for naught\nprocess.on('message', function(message) {\n  if (message === 'shutdown') {\n    gracefulExit.gracefulExitHandler(app, server, {\n        <see options below>\n    });\n  }\n});\n````\n\n## Options\n\n### Middleware\n\nThere are no options available currently.\n\n### Exit Handler\n\nThe following options are available:\n\n Option              |  Description                                     |  Default\n :------------------ |  :---------------------------------------------- |  :-------\n __log__             |  Print status messages and errors to the logger  |  false\n __logger__          |  Function that accepts a string to output a log message  |  console.log\n __callback__        |  Optional function that is called with the exit status code once express has shutdown, gracefully or not <br> Use in conjunction with  `exitProcess: false` when the caller handles process shutdown  |  no-op\n __performLastRequest__ |  Process the first request received per connection after exit starts, and include a connection close header for callers and load balancers. <br> `false` is the existing behavior, deprecated as of v0.5.0 |  false\n __errorDuringExit__ |  Respond to incoming requests with an error instead of silently dropping them. <br> `false` is the existing behavior, deprecated as of v0.5.0  |  false\n __getRejectionError__  |  Function returning rejection error for incoming requests during graceful exit | `function () { return new Error('Server unavailable, no new requests accepted during shutdown') }`\n __exitProcess__      |  If true, the module calls `process.exit()` when express has shutdown, gracefully or not  |  true\n __exitDelay__       |  Wait timer duration in the final internal callback (triggered either by gracefulExitHandler or the hard exit handler) if `exitProcess: true`  |  10ms\n  __suicideTimeout__ |  How long to wait before giving up on graceful shutdown, then returns exit code of 1  |  2m 10s (130s)\n __socketio__        |  An instance of `socket.io`, used to close all open connections after timeout  |  none\n __force__           |  Instructs the module to forcibly close sockets once the suicide timeout elapses. <br> For this option to work you must call `gracefulExit.init(server)` when initializing the HTTP server  |  false\n\n## Details\n\nTo gracefully exit this module does the following things:\n\n1. Closes the http server so no new connections are accepted\n2. Sets connection close header for Keep-Alive connections, if configured for responses</br> The HTTP status code of 502 is returned, so nginx, ELB, etc will try with an active server</br> If `errorDuringExit` and/or `performLastRequest` are set to true, a response is sent with a `Connection: close` header\n3. If a socket.io instance is passed in the options, all connected clients are immediately disconnected (socket.io v0.X through v1.4.x support)</br> The client should have code to reconnect on disconnect\n4. Once the server fully disconnects or the hard exit timer runs\n    1. If all in-flight requests have resolved and/or disconnected, the exit handler returns `0`\n    2. OR if any connections remain after `suicideTimeout` ms, the handler returns `1`\n5. In either case, if exitProcess is set to true the hard exit handler waits exitDelay ms and calls `process.exit(x)`, this allows the logger time to flush and the app's callback to complete, if any\n\n## Zero Downtime Deploys\n\nThis module does not give you zero downtime deploys on its own. It enables the http server to exit gracefully, which when used with a module like naught can provide zero downtime deploys.\n\n#### Author: [Jon Keating](http://twitter.com/emostar)\nThis module was originally developed for Frafty (formerly www.frafty.com), a Daily Fantasy Sports site.\n#### Maintainer: [Ivo Havener](https://github.com/ivolucien)\n\n","readmeFilename":"README.md","gitHead":"51912594df2ab74c4db50b9150a09edb7e11c420","bugs":{"url":"https://github.com/mathrawka/express-graceful-exit/issues"},"_id":"express-graceful-exit@0.5.0-rc.2","_nodeVersion":"12.8.0","_npmVersion":"6.8.0","dist":{"integrity":"sha512-3SY5Hvtzxd//hPpDjlgwxjvN7X+IyDFTDnqPqKFJhOvCZjWeSYbXxO2BLbxicMG5qo7PK77N53ddud6CeLaRLg==","shasum":"15267a3046f837b7ea274c2b124ecc03573b4cc6","tarball":"https://registry.npmjs.org/express-graceful-exit/-/express-graceful-exit-0.5.0-rc.2.tgz","fileCount":6,"unpackedSize":15951,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdqhcFCRA9TVsSAnZWagAAaiwP/iG4rOSp2TMvMSCtLT9v\nM9Q0ay4OqCm2pb0phHrEOA0UdukRafQESXDscl23Lobj6RF56qgzu+IEedvU\nWLgRhyU6bwdPuREtUBksV1Be3Vikw6TFr28uMvYCG9i5XzQfouQSgGqoeDK2\nlU9hQyc4RTafHbSjpM0YTl3qB7+R5X4LxNiU9doL4udTU439rYhWHskLVt+Z\nf7F4+x0L8tgNZOWtfiqaxiKJz/BW79BFUUh03BXc8HSnjdtzvG04gUL0zAaV\nYGW/THa9qbMwH31QH5E54oeTbpFGaZIi3USXc02TWoXp4r2nnvI3Lc/o86Ra\n4V77hlpydhjI7Rne14TErCstE3HqHarajzdsi+RV9t6Xa/pMgTSVqBMzL4vv\nlQQtBmm78crODxMy2gTle7WIDQMdVa2rU/u+acZSmM+BknR41EZ3bDNZktz0\nLTaWzWXgh8uC1dNrQGAtmtbIoqwBXs3J3bXBL7AsyI1KQVpFCQPnrIOqRuNP\nWP0IRU7dB+s7I/OPerc9ua0MmVHeFiqK4UnK+End1JQpXABEnvpz/zdg6j/h\n1AQVC0Pkga6IdYWbV+NmaQTVegXB2QSAxj7L1+KNeujVkewNhjC2dYRWlKNl\nZRVUPUXqQkKvrNut6UgylruMlDgLd3YIMYNC5dGGczaO1z8XpO5Jy/0mBs5D\nVQQw\r\n=OoIS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCYWDegUzgc/Vm7K7+7SMkxcDAIJpCx+PI6RaUJ1DZkkwIgWihRxSuVkmnHE6EKGERGpHCJTudSjWkq9UrrjHKIzPk="}]},"maintainers":[{"name":"ivolucien","email":"ivolucien@gmail.com"},{"name":"mathrawka","email":"jon@licq.org"}],"_npmUser":{"name":"ivolucien","email":"ivolucien@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/express-graceful-exit_0.5.0-rc.2_1571428100880_0.3582045974706862"},"_hasShrinkwrap":false},"0.5.0":{"name":"express-graceful-exit","version":"0.5.0","description":"Allow graceful exits for express apps, supporting zero downtime deploys","keywords":["express","graceful","exit","shutdown","clean","tidy"],"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/mathrawka/express-graceful-exit.git"},"homepage":"https://github.com/mathrawka/express-graceful-exit","author":{"name":"Jon Keating","email":"jon@licq.org"},"contributors":[{"name":"Ivo Havener","email":"ivolucien@gmail.com"}],"license":"MIT","dependencies":{"underscore":"^1.4.4"},"gitHead":"29d936736f74b4943bd21af3152dbbf62e58d884","bugs":{"url":"https://github.com/mathrawka/express-graceful-exit/issues"},"_id":"express-graceful-exit@0.5.0","_nodeVersion":"10.16.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-gZkxdmgYz6VVHjZiMTaO59N875ugmBnzopF95q8Fzmws86JLNWMwGjLVG4i+99WO4v9L5wl6vKYFyGoHKoNJ7A==","shasum":"fcde6495af84f361e66f119bf0e3eca69955f9f1","tarball":"https://registry.npmjs.org/express-graceful-exit/-/express-graceful-exit-0.5.0.tgz","fileCount":6,"unpackedSize":16043,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdrhlUCRA9TVsSAnZWagAA98MQAJW4KeHb60DpAyiDaqMf\n22D48fnQSEMNiMDXgIpcWADCxHfrFFx+OiYSOeFUxz/LcmSWtERTUQg+fFw4\n+em3wgq5nYCCvE2sKrsEpkTeoyQ6Fs4VaSjRZ0Th7W5seluut2RY9+1VnOIz\nCXqQy/4FN3ir/WpNanb5/N4FUixoEJIfrvBjuJlH1yNK5ktVIL9Z9nebu940\nKLS2Pn88NzwxUmWTlH7yetszLSqMcH271Rex7J9TfMEftXhPZvw8KapSPLgN\nEGMdrOT+c/T9W3WZ8lbzvR3GFGoReeWxtCfF/yIwqBGcpuKb94g9EUrTi1aO\n1qV+sFs/VNr4MR6Mknhm45DXfFEJCIPz8LFIetdgJbO8twMj59dpuncGTTcb\ngsnYpXPy4Y7ClSD70DaiVmXFDgIFhlVBIabLG9PznpbDIaicQFMMcvtu4/pC\nixGiZM9I2gH9LKht/qwznKrICb3ArOXJ03Tjxc6dgEXlO4YClPT2FZaUzcTD\nVf2YMWruAaYOJ/Xk/ii8UGXoXOQenVaK+/KQs91NiEQTi9uA2hIZwZWBsEuG\nA/CdgmSnA2bQzTU+vX1/HH5qDXNhVis09ZqLwyjHngxYSsaIKuvpOVXhYqqQ\nJYRM9iKW6u5KW0B1k9PwZAnw6Uagz3g4EM71suQckk+vX+bGT/q3bBjyUkLL\n8wTh\r\n=qsQ5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDV8svg7vMQim67snKUlbpAIRnALMDOtLUKlgOH52d5NQIgUoH2TAdlz7fDGhVEA/kC5dXJOWRo3hjruJhAwm62xKw="}]},"maintainers":[{"name":"ivolucien","email":"ivolucien@gmail.com"},{"name":"mathrawka","email":"jon@licq.org"}],"_npmUser":{"name":"ivolucien","email":"ivolucien@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/express-graceful-exit_0.5.0_1571690835665_0.3790165254723956"},"_hasShrinkwrap":false},"0.5.2":{"name":"express-graceful-exit","version":"0.5.2","description":"Allow graceful exits for express apps, supporting zero downtime deploys","keywords":["express","graceful","exit","shutdown","clean","tidy"],"main":"index.js","types":"index.d.ts","scripts":{"test":"echo \"Error: just manually tested, so far\" && exit 1"},"repository":{"type":"git","url":"git://github.com/mathrawka/express-graceful-exit.git"},"homepage":"https://github.com/mathrawka/express-graceful-exit","author":{"name":"Jon Keating","email":"jon@licq.org"},"contributors":[{"name":"Ivo Havener","email":"ivolucien@gmail.com"}],"license":"MIT","dependencies":{"underscore":"^1.12.1"},"gitHead":"0e4de5cda874cd424802aa9ce03b7a59b19cbfb7","bugs":{"url":"https://github.com/mathrawka/express-graceful-exit/issues"},"_id":"express-graceful-exit@0.5.2","_nodeVersion":"12.20.1","_npmVersion":"6.14.10","dist":{"integrity":"sha512-qBk0zo/2MMFJiodZAfaAMXqaNTVb83/893m34gOCuoySIrzbh0eReBNYXe2LJ7qDJI/JMCnPvvMYeq+Q0ncYJQ==","shasum":"5623f0d8dfd2c8e0011e1c6d12349987adbe6bff","tarball":"https://registry.npmjs.org/express-graceful-exit/-/express-graceful-exit-0.5.2.tgz","fileCount":7,"unpackedSize":17438,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgYmiYCRA9TVsSAnZWagAAxWoP/1EYSXTXX+oVs3Dqkxmk\n3rhJcMLEz3ltaBXhCviZmclMrdKz4NHzbkqqSiZFXJ4KPnaOfPX64t/YxJJY\nRl7eQuTlRU3y0j24OJmPJBUe/+yV88CKv+KhZKszjV3iqK7P2rXkgEYDSS2f\nyDe8QPcL5qhCAJzU2ePKMG4B6XA2C/60Lz7hY0uvT9tjzEmjXD38IShyeA9b\nNPbQaL4uHVSW+QoR7dMsO8AiaGU5ElWRl1kYGdm1E1mdHUZKhE8wr38C/qLL\nrYcFVT3UYCGR2qG350KQ46Dtwr6Josvy3OtEMOZncdzHztpgo55PYAthd5eF\nKDwCUUGYomuYHJDVcjdBf/G7whbJYHEBA5o71K86gr8ZqhAR7WQZSANR3fBS\nEnRCxog0k+gQLt8KfPZoVG9hMxjwyCYnC46+h1/GaptjTLC4w8qS1wMRO+WK\nTvc3FY0ugz7jdOz/JNcrpFLc/2Vx0siVGvz0Eg9NdzYmIooCKvif2bERhBX3\nRssAOWB7Fv9e576FPYLUr/mB0GVKR1hmA6AOqlbE5SXrUumGCaSTv3LuFYIY\nZiUppCd8NxiM3le7agqI2Vd3dNO64eGIbaZJqWdCjn6qUGqpDQl5tyS36O1R\n6nqpsdbFxqoIiHCwpEpyRpKsxg1SW25Yr/DnhIVbx5xmBLOpDYEY5EYsa5G0\nDuVx\r\n=EeNK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAiCMbxRHBBOeMVT0qmZr/SC5IeKYVaRFS41nVnFQmpeAiEAuumcwnEQsaT88wQ29OUZr/FUZNOgWiSTn7VGwZVUeJ8="}]},"_npmUser":{"name":"ivolucien","email":"ivolucien@gmail.com"},"directories":{},"maintainers":[{"name":"mathrawka","email":"jon@licq.org"},{"name":"ivolucien","email":"ivolucien@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/express-graceful-exit_0.5.2_1617062039613_0.5874010087932389"},"_hasShrinkwrap":false}},"readme":"# express-graceful-exit\n\nGracefully decline new requests while shutting down your application. A component that helps support zero downtime deploys for Node.js with [Express](http://expressjs.com/).\n\nThe project was originally developed for Express v3.X, but is used in production with Express v4.X. Please write up an issue or submit a PR if you find bugs using express-graceful-exit with Express v4.X and higher.\n\n## Installation\n\n```` bash\n$ cd /path/to/your/project\n$ npm install express-graceful-exit\n````\n\n## Compatibility\n\nv0.X.X versions are backwards API compatible, with these minor behavior changes:\n1. Process exit is called in a `setTimeout` block from v0.2.0 forward, so the timing is slightly different between v0.1.0 to v0.2.x+.\n2. After exit was triggered, incoming requests were mismanaged prior to v0.5.0. <br> As of v0.5.0 incoming requests are dropped cleanly by default, with new options such as responding with a custom error and/or performing one last request per connection.\n\n## Usage\n\nThe following two components must both be used to enable clean server shutdown, where incoming requests are gracefully declined.\n\nThere are multiple exit options for how in-flight requests are handled, ranging from forced exist after a specified deadline to waiting indefinitely for processing to complete.\n\n### middleware\n\nThis middleware should be the very first middleware that gets setup with your Express app.\n\n```` javascript\nvar express = require('express');\nvar app = express();\nvar gracefulExit = require('express-graceful-exit');\n\nvar server = app.listen(port)\n\ngracefulExit.init(server) // use init() if configured to exit the process after timeout\napp.use(gracefulExit.middleware(app));\n````\n\n### gracefulExitHandler\n\nThis function tells express to accept no new requests and gracefully closes the http server. It can be attached to a signal, or used as a normal function call if another tool is used (such as [naught](https://github.com/indabamusic/naught)).\n\n```` javascript\n// Example for naught\nprocess.on('message', function(message) {\n  if (message === 'shutdown') {\n    gracefulExit.gracefulExitHandler(app, server, {\n        <see options below>\n    });\n  }\n});\n````\n\n## Options\n\n### Middleware\n\nThere are no options available currently.\n\n### Exit Handler\n\nThe following options are available:\n\n Option              |  Description                                     |  Default\n :------------------ |  :---------------------------------------------- |  :-------\n __log__             |  Print status messages and errors to the logger  |  false\n __logger__          |  Function that accepts a string to output a log message  |  console.log\n __callback__        |  Optional function that is called with the exit status code once express has shutdown, gracefully or not <br> Use in conjunction with  `exitProcess: false` when the caller handles process shutdown  |  no-op\n __performLastRequest__ |  Process the first request received per connection after exit starts, and include a connection close header in the response for the caller and/or load balancer. <br> The current default is `false`, but will default to `true` in the next major release, `false` is deprecated as of v0.5.0 |  false, **true is recommended**\n __errorDuringExit__ |  When requests are refused during graceful exit, respond with an error instead of silently dropping them. <br> The current default is `false`, but will default to `true` in the next major release, `false` is deprecated as of v0.5.0 |  false, **true is recommended**\n __getRejectionError__  |  Function returning rejection error for incoming requests during graceful exit | `function () { return new Error('Server unavailable, no new requests accepted during shutdown') }`\n __exitProcess__      |  If true, the module calls `process.exit()` when express has shutdown, gracefully or not  |  true\n __exitDelay__       |  Wait timer duration in the final internal callback (triggered either by gracefulExitHandler or the hard exit handler) if `exitProcess: true`  |  10ms\n  __suicideTimeout__ |  How long to wait before giving up on graceful shutdown, then returns exit code of 1  |  2m 10s (130s)\n __socketio__        |  An instance of `socket.io`, used to close all open connections after timeout  |  none\n __force__           |  Instructs the module to forcibly close sockets once the suicide timeout elapses. <br> For this option to work you must call `gracefulExit.init(server)` when initializing the HTTP server  |  false\n\n## Details\n\nTo gracefully exit this module does the following things:\n\n1. Closes the http server so no new connections are accepted\n2. Sets connection close header for Keep-Alive connections, if configured for responses</br> If `errorDuringExit` is true, HTTP status code 502 is returned by default, so nginx, ELB, etc will resend to an active server</br> If `errorDuringExit` and/or `performLastRequest` are set to true, a response is sent with a `Connection: close` header\n3. If a socket.io instance is passed in the options, all connected clients are immediately disconnected (socket.io v0.X through v1.4.x support)</br> The client should have code to reconnect on disconnect\n4. Once the server fully disconnects or the hard exit timer runs\n    1. If all in-flight requests have resolved and/or disconnected, the exit handler returns `0`\n    2. OR if any connections remain after `suicideTimeout` ms, the handler returns `1`\n5. In either case, if exitProcess is set to true the hard exit handler waits exitDelay ms and calls `process.exit(x)`, this allows the logger time to flush and the app's callback to complete, if any\n\n## Zero Downtime Deploys\n\nThis module does not give you zero downtime deploys on its own. It enables the http server to exit gracefully, which when used with a module like naught can provide zero downtime deploys.\n\n#### Author: [Jon Keating](http://twitter.com/emostar)\nThis module was originally developed for Frafty (formerly www.frafty.com), a Daily Fantasy Sports site.\n#### Maintainer: [Ivo Havener](https://github.com/ivolucien)\n\n","maintainers":[{"name":"mathrawka","email":"jon@licq.org"},{"name":"ivolucien","email":"ivolucien@gmail.com"}],"time":{"modified":"2022-06-17T22:19:08.374Z","created":"2013-03-26T09:45:07.140Z","0.0.1":"2013-03-26T09:45:10.401Z","0.0.2":"2013-03-26T09:46:00.275Z","0.1.0":"2013-03-28T09:02:35.756Z","0.2.1":"2016-07-27T21:29:07.643Z","0.3.0":"2016-08-05T17:03:53.877Z","0.3.3":"2016-08-05T19:47:22.749Z","0.4.0":"2017-04-20T23:36:54.365Z","0.4.1":"2018-01-15T21:39:47.789Z","0.4.2":"2018-10-10T02:50:42.445Z","0.5.0-rc.1":"2019-10-15T16:33:38.163Z","0.5.0-rc.2":"2019-10-18T19:48:21.037Z","0.5.0":"2019-10-21T20:47:15.801Z","0.5.2":"2021-03-29T23:53:59.738Z"},"author":{"name":"Jon Keating","email":"jon@licq.org"},"repository":{"type":"git","url":"git://github.com/mathrawka/express-graceful-exit.git"},"users":{"chichilatte":true,"gregorynicholas":true,"bapinney":true},"homepage":"https://github.com/mathrawka/express-graceful-exit","license":"MIT","readmeFilename":"README.md","keywords":["express","graceful","exit","shutdown","clean","tidy"],"contributors":[{"name":"Ivo Havener","email":"ivolucien@gmail.com"}],"bugs":{"url":"https://github.com/mathrawka/express-graceful-exit/issues"}}