Skip to main content
Module

x/allo_routing/mod.ts>MaskRouter

🦕 Routing solution for Deno
Go to Latest
class MaskRouter
implements IRouter
extends Router
Re-export
import { MaskRouter } from "https://deno.land/x/allo_routing@v1.0.2/mod.ts";

Class MaskRouter is a router that mathing url by mask.

Some part of the mask can be optional. This part is closed to [ and ].

Mask may contains parameters. Parameter is defined by < and > symbols. In the parameter you can specific the default value. <param=default> Also you can define regular expression for value validation.<param=default regexp>

Examples:

  • product[/detail]
  • [product[/detail]]
  • product/<id>
  • page/<id=123 \\d+>

Constructors

new
MaskRouter(
mask: string,
serveResponse: ServeResponseType,
options?: RouterOptions,
)

Methods

match(req: Request): boolean