Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/http_wrapper/Router.ts>Router

Simple Server/Router wrapper around Deno's HTTP module
Latest
class Router
import { Router } from "https://deno.land/x/http_wrapper@v0.5.0/Router.ts";

Constructors

new
Router(root?)

Properties

private
_delete: EndpointMap
private
_get: EndpointMap
private
_head: EndpointMap
private
_options: EndpointMap
private
_patch: EndpointMap
private
_post: EndpointMap
private
_put: EndpointMap
private
root: string
readonly
routes: Endpoint

Getter used to register all endpoints in this router with the Server.

Methods

private
process(
route: string,
func: (req: ServerRequest, vars: RouteVariables) => void,
target: EndpointMap,
)
delete(route: string, func: (req: ServerRequest, vars: RouteVariables) => void)

Register a DELETE endpoint

get(route: string, func: (req: ServerRequest, vars: RouteVariables) => void)

Register a GET endpoint

head(route: string, func: (req: ServerRequest, vars: RouteVariables) => void)

Register a HEAD endpoint

options(route: string, func: (req: ServerRequest, vars: RouteVariables) => void)

Register an OPTIONS endpoint

patch(route: string, func: (req: ServerRequest, vars: RouteVariables) => void)

Register a PATCH endpoint

post(route: string, func: (req: ServerRequest, vars: RouteVariables) => void)

Register a POST endpoint

put(route: string, func: (req: ServerRequest, vars: RouteVariables) => void)

Register a PUT endpoint