Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gquittet/graceful-server
Tiny (~5k), KISS, dependency-free Node.JS library to make your API more graceful
https://github.com/gquittet/graceful-server
docker dockerfile expressjs fastify graceful graceful-server health-check kiss kubernetes liveness nodejs probes readiness server tiny
Last synced: 2 days ago
JSON representation
Tiny (~5k), KISS, dependency-free Node.JS library to make your API more graceful
- Host: GitHub
- URL: https://github.com/gquittet/graceful-server
- Owner: gquittet
- License: other
- Created: 2020-02-18T01:20:29.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-12-17T11:12:44.000Z (5 days ago)
- Last Synced: 2024-12-18T19:08:54.898Z (4 days ago)
- Topics: docker, dockerfile, expressjs, fastify, graceful, graceful-server, health-check, kiss, kubernetes, liveness, nodejs, probes, readiness, server, tiny
- Language: TypeScript
- Homepage:
- Size: 925 KB
- Stars: 289
- Watchers: 5
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
🚀 Graceful Server 🐢
Tiny (~5k), KISS, dependency-free Node.JS library to make your Rest API graceful.---
- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [NPM](#npm)
- [PNPM](#pnpm)
- [YARN](#yarn)
- [Endpoint](#endpoint)
- [/live](#live)
- [/ready](#ready)
- [Example](#example)
- [API Doc](#api-doc)
- [Integration with Docker](#integration-with-docker)
- [Integration with Kubernetes](#integration-with-kubernetes)
- [Thanks](#thanks)
- [Sponsors](#sponsors)
- [Donate](#donate)## Features
✔ It's listening 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 avoid boilerplate codes.
✔ Kubernetes compliant.
✔ Dependency-free.
✔ KISS code base.
## Requirements
✔ NodeJS >= 18.0
## Installation
### NPM
```
npm install --save @gquittet/graceful-server
```### PNPM
```
pnpm add @gquittet/graceful-server
```### YARN
```
yarn add @gquittet/graceful-server
```## Endpoint
Below you can find the default endpoint but you can setup or disable them. To do that, check out the [Options](#options) part.
###
/live
The endpoint responds:
- `200` status code with the uptime of the server in second.
```json
{ "uptime": 42 }
```Used to configure liveness probe.
###
/ready
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).
## Example
See: [EXAMPLE.md](./docs/EXAMPLE.md)
## API Doc
See: [API.md](./docs/API.md)
## Integration with Docker
See: [DOCKER.md](./docs/DOCKER.md)
## Integration with Kubernetes
See: [KUBERNETES.md](./docs/KUBERNETES.md)
## Thanks
★ [Terminus](https://github.com/godaddy/terminus)
★ [Lightship](https://github.com/gajus/lightship)
★ [Stoppable](https://github.com/hunterloftis/stoppable)
★ [Bret Fisher](https://github.com/BretFisher) for his great articles and videos
★ [IBM documentation](https://cloud.ibm.com/docs/node?topic=nodejs-node-healthcheck)
★ [Node HTTP documentation](https://nodejs.org/api/http.html)
★ [Cloud Health](https://github.com/CloudNativeJS/cloud-health)
★ [Cloud Health Connect](https://github.com/CloudNativeJS/cloud-health-connect)
## Sponsors
![JetBrains Logo](assets/sponsors/jetbrains.svg)
## Donate
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JN3XLTQCX3NR8&source=url)
If you like my job, don't hesitate to contribute to this project! ❤️