Tiny (~5k), dependency-free Node.JS library to make your API more graceful
npm install @gquittet/graceful-server
Tiny (~5k), KISS, dependency-free Node.js library to make your Rest API graceful.
---
- Features
- Requirements
- Installation
- NPM
- PNPM
- YARN
- Endpoint
- /live
- /ready
- Example
- API Doc
- Integration with Docker
- Integration with Kubernetes
- Thanks
- Sponsors
- Donate
ā It's listening to system events to gracefully close your API on interruption.
ā It facilitates the disconnect of data sources on shutdown.
ā It facilitates the use of liveness and readiness.
ā It manages the connections of your API.
ā It avoids boilerplate codes.
ā Kubernetes compliant.
ā Dependency-free.
ā KISS code base.
ā NodeJS >= 20.0
```
npm install --save @gquittet/graceful-server
``
pnpm add @gquittet/graceful-server
``
yarn add @gquittet/graceful-server
Below, you can find the default endpoint, but you can set up or disable them. To do that, check out the Options part.
The endpoint responds:
- 200 status code with the uptime of the server in second.
`json`
{ "uptime": 42 }
Used to configure liveness probe.
The endpoint responds:
- 200 status code if the server is ready.
`json`
{ "status": "ready" }
- 503` status code with an empty response if the server is not ready (started, shutting down, etc.).
See: EXAMPLE.md
See: API.md
See: DOCKER.md
See: KUBERNETES.md
ā Terminus
ā Lightship
ā Stoppable
ā Bret Fisher for his great articles and videos
ā Cloud Health

If you like my job, don't hesitate to contribute to this project! ā¤ļø