# nginx-plus-dynamic-upstream

> Allows to register/unregister app in Nginx+

Latest version **2.2.0** (published 2020-06-09) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install nginx-plus-dynamic-upstream
pnpm add nginx-plus-dynamic-upstream
yarn add nginx-plus-dynamic-upstream
bun add nginx-plus-dynamic-upstream
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2020-06-09 |
| First published | 2019-12-19 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 16.9 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Vladlen Fedosov |
| Maintainers | stylet |
| Keywords | nginx, upstream, api |

## Links

- npm: https://www.npmjs.com/package/nginx-plus-dynamic-upstream
- Repository: https://github.com/StyleT/nginx-plus-dynamic-upstream
- Homepage: https://github.com/StyleT/nginx-plus-dynamic-upstream#readme
- Issues: https://github.com/StyleT/nginx-plus-dynamic-upstream/issues
- npm.io page: https://npm.io/package/nginx-plus-dynamic-upstream

## Dependencies (3)

- [request](https://npm.io/package/request.md) ^2.88.0
- [url-join](https://npm.io/package/url-join.md) ^4.0.1
- [request-promise-native](https://npm.io/package/request-promise-native.md) ^1.0.8

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 2.2.0 (latest) — 2020-06-09
- 2.1.2 — 2020-04-13
- 2.1.1 — 2020-04-13
- 2.1.0 — 2020-04-03
- 2.0.0 — 2020-01-14
- 1.0.1 — 2019-12-19
- 1.0.0 — 2019-12-19

## README

# nginx-plus-dynamic-upstream

This library allows to register/unregister app in Nginx+

## Usage example

```javascript
const nginxReg = new (require('nginx-plus-dynamic-upstream'))({ /* ... */ }, console);
const http     = require('http');

const server = http.createServer();
server.on('listening', () => {
   const addr = server.address();
   const bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;
   global.console.log('Listening on ' + bind);

   nginxReg.initHandler().catch(err => {
       console.error('Error happened during registration in Nginx. Ending execution...');
       console.error(err);
       process.exit(1);
   })
});

process.on('SIGTERM', () => exitHandler());
process.on('SIGINT', () => exitHandler());
process.on('exit', () => exitHandler());

function exitHandler() {
    console.log('Shutting down HTTP server...');

    nginxReg.exitHandler().then(() => {
        server.close();
        process.exit(0);
    }).catch(err => {
        console.error('Error happened during unregistration in Nginx. Ending execution...');
        console.error(err);
        process.exit(1);
    });
}

```

---
_Source: https://npm.io/package/nginx-plus-dynamic-upstream · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
