createVersionRoute
●next-build-notifier · /index·function
Creates a Next.js App Router route handler that serves the current deployment's build id as
{ id, ts }. Mount it at a stable path (default convention: /api/version) and export its GET.
The response is no-store so a polling client always sees the live deployment's id.
Signature
function createVersionRoute(options: CreateVersionRouteOptions): { GET: () => Promise<Response> };Parameters
| Name | Type | Description |
|---|---|---|
options | CreateVersionRouteOptions |
Returns
An object with a GET handler returning a web Response.
Example
// app/api/version/route.ts
import { createVersionRoute } from 'next-build-notifier/server';
export const dynamic = 'force-dynamic';
export const { GET } = createVersionRoute();Related
WithBuildNotifierOptions withBuildNotifier BuildNotificationState BuildNotifierConfig BuildNotifierProps BuildNotifierProviderProps VersionResponse BuildNotifier