|
5 | 5 | - [Fastify](#fastify)
|
6 | 6 | - [Koa](#koa)
|
7 | 7 | - [HTTP Server](#http-server)
|
8 |
| - - [GracefulServer](#gracefulserver) |
9 |
| - - [IGracefulServerOptions](#igracefulserveroptions) |
10 |
| - - [GracefulServer Instance](#gracefulserver-instance) |
11 | 8 |
|
12 | 9 |
|
13 | 10 | ## ExpressJS
|
@@ -185,39 +182,3 @@ server.listen(8080, async () => {
|
185 | 182 | gracefulServer.setReady()
|
186 | 183 | })
|
187 | 184 | ```
|
188 |
| - |
189 |
| -## GracefulServer |
190 |
| - |
191 |
| -```typescript |
192 |
| -;((server: http.Server, options?: IGracefulServerOptions | undefined) => IGracefulServer) & typeof State |
193 |
| -``` |
194 |
| - |
195 |
| -where `State` is an enum that contains, `STARTING`, `READY`, `SHUTTING_DOWN` and `SHUTDOWN`. |
196 |
| - |
197 |
| -## IGracefulServerOptions |
198 |
| - |
199 |
| -All of the below options are optional. |
200 |
| - |
201 |
| -| Name | Type | Default | Description | |
202 |
| -| ----------------- | :------------------------: | :-----: | ---------------------------------------------------------------: | |
203 |
| -| syncClose | boolean | false | Run the closePromises in a series. | |
204 |
| -| closePromises | (() => Promise<unknown>)[] | [] | The functions to run when the API is stopping | |
205 |
| -| timeout | number | 1000 | The time in milliseconds to wait before shutting down the server | |
206 |
| -| healthCheck | boolean | true | Enable/Disable the default endpoints (liveness and readiness) | |
207 |
| -| kubernetes | boolean | false | Enable/Disable the kubernetes mode | |
208 |
| -| livenessEndpoint | string | /live | The liveness endpoint | |
209 |
| -| readinessEndpoint | string | /ready | The readiness endpoint | |
210 |
| - |
211 |
| -If you use Kubernetes, enable the kubernetes mode to let it handles the incoming traffic of your application. |
212 |
| - |
213 |
| -The Kubernetes mode will only work if you haven't disabled the health checks. |
214 |
| - |
215 |
| -## GracefulServer Instance |
216 |
| - |
217 |
| -```typescript |
218 |
| -export default interface IGracefulServer { |
219 |
| - isReady: () => boolean |
220 |
| - setReady: () => void |
221 |
| - on: (name: string, callback: (...args: any[]) => void) => EventEmitter |
222 |
| -} |
223 |
| -``` |
0 commit comments