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

stoppable

Package Overview
Dependencies
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stoppable

[![Build Status](https://travis-ci.org/hunterloftis/stoppable.svg?branch=master)](https://travis-ci.org/hunterloftis/stoppable)

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3M
decreased by-23.91%
Maintainers
3
Weekly downloads
 
Created

What is stoppable?

The 'stoppable' npm package allows you to gracefully stop an HTTP server, ensuring that all active connections are properly closed before the server shuts down. This is particularly useful for applications that need to handle shutdowns gracefully without abruptly terminating ongoing requests.

What are stoppable's main functionalities?

Graceful Shutdown

This feature allows you to stop an HTTP server gracefully. The code sample demonstrates how to create a stoppable server and then stop it gracefully, ensuring that all active connections are properly closed.

const http = require('http');
const stoppable = require('stoppable');

const server = http.createServer((req, res) => {
  res.end('Hello, world!');
});

const stoppableServer = stoppable(server);

server.listen(3000, () => {
  console.log('Server is listening on port 3000');
});

// To stop the server gracefully
stoppableServer.stop((err, gracefully) => {
  if (err) {
    console.error('Error during shutdown:', err);
  } else {
    console.log('Server has been stopped gracefully:', gracefully);
  }
});

Other packages similar to stoppable

Keywords

FAQs

Package last updated on 10 Nov 2018

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