interface IRouterApi
Since 0.1.0

Router registration surface exposed to plugins and applications.

Every verb method accepts either a bare handler or a full RouteDefinition with middleware and schemas.

Methods

get(
path: string,
): void

Registers a GET route.

post(
path: string,
): void

Registers a POST route.

put(
path: string,
): void

Registers a PUT route.

patch(
path: string,
): void

Registers a PATCH route.

delete(
path: string,
): void

Registers a DELETE route.

head(
path: string,
): void

Registers a HEAD route.

options(
path: string,
): void

Registers an OPTIONS route.

group(
prefix: string,
configure: (router: IRouterApi) => void
): void

Creates a route group: routes registered inside the callback share the prefix and any group middleware.

Since 0.1.0
listRoutes(): readonly RouteInfo[]

Returns all registered routes for introspection.

Used by the OpenAPI plugin to generate documentation from route definitions.

Usage

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