open-index/open-npm huggingface dataset:
npm package: @jeanniton-mnr/super-graceful-shutdown
Description: The super-graceful-shutdown npm package provides a super graceful way to shutdown an Express server application.
Author: Monero
Latest version: 1.0.2

<!-- After completing the above you can use `npm publish` to publish your package, complete with type definitions and docs. -->


## Description

The super-graceful-shutdown npm package provides a super graceful way to shutdown an Express server application.

super-graceful-shutdown always make sure a response is sent to the client for any connections that were open before you send a super graceful "shutdown" message.

When you send the default `shutdown` message on default port `3000` to your node the Express app, super-graceful-shutdown will gracefully wait for all requests to close, ensuring a response is sent to the client; block any new connections; shutdown the server; then terminate node process.


## Usage
To use the super-graceful-shutdown package, follow these steps:

1. Import the package and initialize it using its constructor with an instance of your Express app and server:

```
const express = require('express');
const SGS = require('super-graceful-shutdown');

const app = express();
const router = express.Router();
const port = 80; // Set your desired port number

// ...

router.get('/api1', async function(req, res, next){
  try {
      setTimeout(() => { res.status(200).send(`<html> <body> <h1>${date()}</h1> </body> </html>`)  }, 3000);
    } catch (error) {
      next(error);
    }
});

const server = app.listen(port, () => console.log(`Example Express app listening on port ${port}!`) );

// ℹ️ Before you initialize other routes, you need to initialize super-graceful-shutdown
new SGS(app, server);

// 👨‍💻 Then, you can initialize other routes
app.use('/', router);
```

2. Once your Express app is running, to super gracefully shutdown your Node.Js Express application through your host CLI, run this command:

```
echo "shutdown" | nc localhost 3000
````

## Notes
Do not expose port 3000 to prevent outsiders from shutting down your application. You can [find](https://www.digitalocean.com/community/tutorials/opening-a-port-on-linux) an article on how to allow or block a port to the outside network in this link provided by DigitalOcean.

## Reference:
I have this npm [package boilerplate](https://github.com/ryansonshine/typescript-npm-package-template/tree/main) to create this package.

### Author
[Monero Jeanniton](https://www.linkedin.com/in/monero-jeanniton-0431826a/)
npm package: @jeanpereirarj/getsandbox-express
Description: getsandbox-express adapter and cli
Author: xbtsw
Latest version: 1.1.4

# @jeanpereirarj/getsandbox-express
A getsandbox.com to express adapter

## Usage

### as command-line tool, without installing

```bash
npx @jeanpereirarj/getsandbox-express <main.js> [<port>]
```

Alternatively, if you want to install it globally:

```bash
npm install -g @jeanpereirarj/getsandbox-express
sandbox <main.js> [<port>]
```

Default port is `8080`.

### as Node.js module

```js
const sandbox = require('@jeanpereirarj/getsandbox-express')
const express = require('express')

const app = express()
sandbox.loadSandbox(app, __dirname + '/mysandbox/main.js')

const port = 8080
app.listen(port, () => {
  console.log(`Sandbox listening on port ${port}.`)
})
```