Module

x/ash/mod.ts>Route

A stylish web framework for Deno!
Latest
class Route
import { Route } from "https://dotland.deno.dev/x/ash@1.3.6/mod.ts";

Constructors

new
Route(
methods: string[],
path: string,
pattern: RegExp,
controller: Controller | Function,
catchall?: boolean,
)

Creates and configures a Route object.

Properties

_middleware: Middleware[]

A list of local middleware.

stack: Function

The middleware stack.

Methods

Recompiles the Route's stack and reloads the middleware.

middleware(ware: string | Middleware)

Loads a middleware

where(regex: Dynamic)

Adds a custom RegExp to a route.

Static Properties

private
routes: Route[]

The list of registered routes.

_middleware: Middleware[]

A list of global middleware.

Static Methods

private
register(
methods: string | string[],
path: string,
controller: Controller | Function,
): Route

Registers a route.

any(path: string, controller: Controller | Function): Route

Registers a route that matches for the any HTTP method.

Recompiles all of the route stacks.

delete(path: string, controller: Controller | Function): Route

Registers a route that matches for the HTTP DELETE method.

get(path: string, controller: Controller | Function): Route

Registers a route that matches for the HTTP GET method.

match(
methods: string | string[],
path: string,
controller: Controller | Function,
): Route

Registers a route that matches for the the provided HTTP methods.

matchRoute(method: string, path: string): RouteMatchResult

Looks for a matching route and returns it.

middleware(ware: string | Middleware)

Loads a middleware

options(path: string, controller: Controller | Function): Route

Registers a route that matches for the HTTP OPTIONS method.

patch(path: string, controller: Controller | Function): Route

Registers a route that matches for the HTTP PATCH method.

post(path: string, controller: Controller | Function): Route

Registers a route that matches for the HTTP POST method.

put(path: string, controller: Controller | Function): Route

Registers a route that matches for the HTTP PUT method.

supported(): string[]

Returns a list of supported HTTP methods.

test(
path: string,
input: string,
reg?: Dynamic,
): RouteResult

Test if a route path matches the input route.

import Route
import { Route } from "https://dotland.deno.dev/x/ash@1.3.6/mod.ts";