x/oak/router.ts

A middleware framework for handling HTTP with Deno, Node, Bun and Cloudflare Workers 🐿️ 🦕
Very Popular
Latest
method Router.prototype.add
import { Router } from "https://dotland-vbqsvsrpfncg.deno-staging.dev/x/oak@v17.1.2/router.ts?p=prototype.add&s=Router";

Register named middleware for the specified routes when specified methods are requested.

Type Parameters

R extends string[src]
optional
P extends RouteParams<R> = RouteParams<R>
[src]
optional
S extends State = RS
[src]

Parameters

name: string[src]
path: R[src]
middleware: RouterMiddleware<R, P, S>[src]
...middlewares: RouterMiddleware<R, P, S>[][src]

Returns

Router<S extends RS ? S : (S & RS)>[src]

Register middleware for the specified routes when the specified methods is requested.

Type Parameters

R extends string[src]
optional
P extends RouteParams<R> = RouteParams<R>
[src]
optional
S extends State = RS
[src]

Parameters

path: R[src]
middleware: RouterMiddleware<R, P, S>[src]
...middlewares: RouterMiddleware<R, P, S>[][src]

Returns

Router<S extends RS ? S : (S & RS)>[src]

Register middleware for the specified routes when the specified methods are requested with explicit path parameters.

Type Parameters

P extends RouteParams<string>[src]
optional
S extends State = RS
[src]

Parameters

nameOrPath: string[src]
pathOrMiddleware: string | RouterMiddleware<string, P, S>[src]
...middleware: RouterMiddleware<string, P, S>[][src]

Returns

Router<S extends RS ? S : (S & RS)>[src]