x/oak/router.ts

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

An internal class used to group together middleware when using multiple middlewares with a router.

Constructors

new
Layer(
path: string,
methods: HTTPMethods[],
middleware: RouterMiddleware<R, P, S> | RouterMiddleware<R, P, S>[],
unnamed 3?: LayerOptions,
)
[src]

Type Parameters

R extends string[src]
optional
P extends RouteParams<R> = RouteParams<R>
[src]
optional
S extends State = Record<string, any>
[src]

Properties

methods: HTTPMethods[][src]
optional
name: string
[src]
path: string[src]

Methods

captures(path: string): string[][src]
match(path: string): boolean[src]
param(param: string, fn: RouterParamMiddleware<any, any, any>): this[src]
params(captures: string[], existingParams?: RouteParams<R>): RouteParams<R>[src]
setPrefix(prefix: string): this[src]
toJSON(): Route<any, any, any>[src]
url(params?: RouteParams<R>, options?: UrlOptions): string[src]
[Symbol.for("Deno.customInspect")](inspect: (value: unknown) => string): string[src]
[Symbol.for("nodejs.util.inspect.custom")](
depth: number,
options: any,
inspect: (value: unknown, options?: unknown) => string,
): any
[src]