Module

x/denorest/mod.ts>Router

Lightweight, Minimalist Framework For REST API 🦕 🚀
Latest
class Router
import { Router } from "https://dotland.deno.dev/x/denorest@v4.2/mod.ts";

Use the Router class to create modular, mountable route handlers.

Properties

all: (
path: string,
hand: (req: Req, res: Res) => void,
hook?: ((req: Req, res: Res) => void)[],
) => unknown

for all req method

delete: (
path: string,
hand: (req: Req, res: Res) => void,
hook?: ((req: Req, res: Res) => void)[],
) => unknown

for only DELETE method

get: (
path: string,
hand: (req: Req, res: Res) => void,
hook?: ((req: Req, res: Res) => void)[],
) => unknown

for only GET method

getRoutes: (m?: boolean) => unknown

get all routes in current router

head: (
path: string,
hand: (req: Req, res: Res) => void,
hook?: ((req: Req, res: Res) => void)[],
) => unknown

for only HEAD method

hook: ((req: Req, res: Res) => void)[]
options: (
path: string,
hand: (req: Req, res: Res) => void,
hook?: ((req: Req, res: Res) => void)[],
) => unknown

for only OPTIONS method

patch: (
path: string,
hand: (req: Req, res: Res) => void,
hook?: ((req: Req, res: Res) => void)[],
) => unknown

for only PATCH method

post: (
path: string,
hand: (req: Req, res: Res) => void,
hook?: ((req: Req, res: Res) => void)[],
) => unknown

for only POST method

pre: (path: string, r: Router) => unknown

add prefix routes

put: (
path: string,
hand: (req: Req, res: Res) => void,
hook?: ((req: Req, res: Res) => void)[],
) => unknown

for only PUT method

routes: Routes[]
use: (hand: (req: Req, res: Res) => void) => unknown

add hook