Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

http-shutdown

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-shutdown

Gracefully shutdown a running HTTP server.

  • 1.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2M
increased by6.33%
Maintainers
1
Weekly downloads
 
Created

What is http-shutdown?

The http-shutdown npm package extends the standard Node.js HTTP server with a shutdown method. This allows you to gracefully shut down the server, ensuring that all existing connections are served before the server is closed.

What are http-shutdown's main functionalities?

Graceful Shutdown

This feature allows you to add a shutdown method to your HTTP server instance. When called, it will not accept new connections and will wait for all existing connections to end before shutting down the server.

const http = require('http');
const enableShutdown = require('http-shutdown');

const server = enableShutdown(http.createServer((req, res) => {
  res.writeHead(200);
  res.end('Hello World!');
}));

server.listen(3000);

// Shutdown the server after 10 seconds
setTimeout(() => {
  server.shutdown(() => {
    console.log('Server is gracefully shut down.');
  });
}, 10000);

Other packages similar to http-shutdown

Keywords

FAQs

Package last updated on 10 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc