x/oak/router.ts

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

Register middleware to be used on every matched route.

Type Parameters

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

Parameters

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

Returns

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

Register middleware to be used on every route that matches the supplied path.

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 to be used on every route that matches the supplied path with explicit path parameters.

Type Parameters

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

Parameters

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

Returns

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

Type Parameters

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

Parameters

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

Returns

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