npm

Need private packages and team management tools?Check out npm Orgs. »

hapi-graceful-shutdown-plugin

2.0.8 • Public • Published

About hapi-graceful-shutdown-plugin

Another hapi plugin to facilitate graceful shutdowns caused by sigterm and sigint. Updated to work with Hapi v17 and v18. Older versions of the plugin support Hapi v16.

Build Status

Install

npm install hapi-graceful-shutdown-plugin --save

Usage

'use strict';
 
const Hapi = require('@hapi/hapi');
 
const server = new Hapi.Server({
    host: localhost,
    port: 3000
});
 
const startup = async () => {
    await server.register([{
        plugin: require('hapi-graceful-shutdown-plugin'),
        options: {
            sigtermTimeout: 10,
            sigintTimeout: 1
        }
    }]);
    await server.start();
};
 
startup().catch((err) => {
    throw err;
});
 
console.log(`${new Date()}: server running at ${server.info.uri}`);

install

npm i hapi-graceful-shutdown-plugin

Downloadsweekly downloads

177

version

2.0.8

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability