🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

stoppable

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
s

stoppable

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

1.1.0
latest
100

Supply Chain Security

100

Vulnerability

100

Quality

80

Maintenance

100

License

Network access

Supply chain risk

This module accesses the network.

Found 1 instance in 1 package

Version published
Weekly downloads
3.8M
1.02%
Maintainers
3
Weekly downloads
 
Created
Issues
28

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

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