Skip to main content
Module

x/rutt/mod.ts>router

🛣️ A tiny and fast http request router designed for use with deno and deno deploy
Latest
function router
import { router } from "https://deno.land/x/rutt@0.2.0/mod.ts";

A simple and tiny router for deno. This function provides a way of constructing a HTTP request handler for the provided routes and any provided RouterOptions.

Examples

Example 1

import { router } from "https://deno.land/x/rutt/mod.ts";

await Deno.serve(
  router({
    "/": (_req) => new Response("Hello world!", { status: 200 }),
  }),
).finished;

Type Parameters

optional
T = unknown

Parameters

routes: Routes<T> | InternalRoutes<T>

A record of all routes and their corresponding handler functions

optional
unnamed 1: RouterOptions<T> = [UNSUPPORTED]

An object containing all of the possible configuration options

Returns

A deno std compatible request handler