JSR

Class to use as programmatic router (alternative to the file-based router).

Type Parameters

E = void

View code

C = void

View code

Methods

addRoute(

method: "all" | HttpMethod,

pathname: string,

opts: RouteOpts<E, C>

): this

View code

Add route

createHandler(opts?: { serveStaticFiles?: boolean; }): Handler<E, C>

View code

Create fetch handler

delete(

pathname: string,

handler: RouteOpts<E, C>

): this

View code

Add HTTP DELETE route

generate(opts?: Omit<GenerateOpts, "routes" | "writeRoutenames">): Promise<void>

View code

Generate static site

get(

pathname: string,

handler: RouteOpts<E, C>

): this

View code

Add HTTP GET route

post(

pathname: string,

handler: RouteOpts<E, C>

): this

View code

Add HTTP POST route

put(

pathname: string,

handler: RouteOpts<E, C>

): this

View code

Add HTTP PUT route

Read the original on jsr.io ↗