Skip to main content

Function: unpublishRoute()

unpublishRoute(store, route): Promise<void>

Defined in: unpublishRoute.ts:31

Takes a route offline and invalidates that one page — the body of the POST /api/nubbin/unpublish handler an application exposes, which is where nubbin unpublish --origin <url> sends { route }.

Like publishRoute, it has to run inside the serving process: revalidatePath reaches only that process's cache, so a pointer dropped from a terminal leaves the page still being served.

Parameters​

store​

ArtifactStore

The store serving the application. unpublish is the only method called.

route​

string

The route to stop serving, exactly as it was published.

Returns​

Promise<void>

Nothing. The artifact stays readable at its hash — only the pointer goes — so restoring the route is a publishRoute at the same hash.

Throws​

Whatever store.unpublish raises, before anything is invalidated. Unpublishing a route with no pointer is a no-op rather than a refusal.

Example​

export async function POST(request: Request) {
const { route } = (await request.json()) as { route: string };
await unpublishRoute(store, route);
return Response.json({ ok: true, route });
}