How to use http-graceful-shutdown - 2 common examples

To help you get started, we’ve selected a few http-graceful-shutdown examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Netflix / pollyjs / packages / @pollyjs / node-server / src / server.js View on Github external
.listen(port, host)
      .on('listening', () => {
        if (!this.config.quiet) {
          console.log(`Listening on http://${host || 'localhost'}:${port}/\n`);
        }
      })
      .on('error', e => {
        if (e.code === 'EADDRINUSE') {
          console.error(`Port ${port} already in use.`);
          process.exit(1);
        } else {
          console.error(e);
        }
      });

    gracefulShutdown(this.server);

    return this.server;
  }
}
github Evaneos / vitaminjs / packages / vitaminjs-runtime / src / server / server.js View on Github external
const server = mountedServer.listen(port, host, () => {
    readline.clearLine(process.stdout);
    readline.cursorTo(0, process.stdout);
    process.stdout.write(`\x1b[0G${chalk.green('\u2713')} Server listening on: ${
        chalk.bold.underline(`http://${host}:${port}${config.basePath}`)
    }\n`);
    if (module.hot) {
        console.log(`${chalk.green('\u2713')} ${chalk.bold('Hot module reload')} activated`);
        process.stdout.write(`\x1b[0G${
            chalk.blue('\uD83D\uDD50  Building client bundle [in memory]...')
        }`);
    }
});

httpGracefulShutdown(server, {
    signals: 'SIGINT SIGTERM SIGQUIT',
    timeout: 15000,
    development: process.env.NODE_ENV !== 'production',
    callback: () => {},
});

http-graceful-shutdown

gracefully shuts downs http server

MIT
Latest version published 1 year ago

Package Health Score

59 / 100
Full package analysis

Popular http-graceful-shutdown functions