import { Router } from "https://deno.land/x/duck_web_framework@0.1.1/router.ts";
Router stores route handlers and middlewares. It can have a base URL specified, which will be prepended to every route. Every middleware will only work on requests that point to URL that starts with that base.
Methods
private
route()all(path: string, ...middlewares: MiddlewareFunction[])
Uses specified middleware(s) on given path, matching all HTTP methods
delete(path: string, ...middlewares: MiddlewareFunction[])
get(path: string, ...middlewares: MiddlewareFunction[])
Uses specified middleware(s) on given path, if request method is GET. All other methods match HTTP methods according to their name (post matches POST, delete matches DELETE etc.)
head(path: string, ...middlewares: MiddlewareFunction[])
patch(path: string, ...middlewares: MiddlewareFunction[])
post(path: string, ...middlewares: MiddlewareFunction[])
put(path: string, ...middlewares: MiddlewareFunction[])
use(middlewareHandler: MiddlewareFunction | ErrorMiddlewareFunction | Router)
Pushes given middleware or merges another router's middlewares with this router's middlewares