Module

x/ash/mod.ts>default

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

Methods

abstract
handle(request: Request, next: Function): string

Called before a route is requested.

Methods

abstract
show(...args: any): string

Called when a route that is assigned to this controller is requested.

Methods

handle(req: Request, next: Function): string

Constructors

new
default(
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.

Properties

private
events: Dynamic

Methods

emit(name: string, ...args: any)

Emits an event, calling all of its listeners.

on(name: string, callback: Function)

Listens for an event.

Constructors

new
default(staticPath?: string, staticRoute?: string)

Creates an AshStaticMiddleware instance.

Properties

private
regexp: RegExp
private
staticPath: string
private
staticRoute: string

Methods

handle(req: Request, next: Function): string
interface default
import { type default } from "https://dotland.deno.dev/x/ash@1.3.6/mod.ts";

Index Signatures

[key: string]: any
variable default
import { default } from "https://dotland.deno.dev/x/ash@1.3.6/mod.ts";
function default
import { default } from "https://dotland.deno.dev/x/ash@1.3.6/mod.ts";

Gets a mime type from a file extension.

Parameters

ext: string

The extension to get the mime type of.