method ILifecycleApi.onShutdown
ILifecycleApi.onShutdown(fn: () => void | Promise<void>): void

Runs when shutdown begins — close connections, flush buffers here.

By this point the application is already refusing new requests and the server socket is closed; use onStopping for work that must happen while traffic is still being served.

Parameters

fn: () => void | Promise<void>

Hook body

Return Type

void

Usage

import { type ILifecycleApi } from "common/src/index.ts";