Iskra API Reference
    Preparing search index...

    Interface RouteOptions<B, Q>

    A WebDriver route. schema takes Zod schemas (v3 or v4); the body and query types the handler receives are inferred from them.

    interface RouteOptions<B = unknown, Q = unknown> {
        doc?: { description?: string; summary?: string; tags?: string[] };
        method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
        path: string;
        schema?: {
            body?: ZodSchemaLike<B>;
            params?: ZodSchemaLike<unknown>;
            query?: ZodSchemaLike<Q>;
        };
        handler(ctx: WebContext<B, Q>): unknown;
    }

    Type Parameters

    • B = unknown
    • Q = unknown
    Index
    doc?: { description?: string; summary?: string; tags?: string[] }
    method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH"
    path: string
    schema?: {
        body?: ZodSchemaLike<B>;
        params?: ZodSchemaLike<unknown>;
        query?: ZodSchemaLike<Q>;
    }
    • Returns a Response, or data sent as JSON. A method, so routes with different body types still fit in one RouteOptions[].

      Parameters

      Returns unknown