Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

router

import { router } from "https://crux.land/api/get/2KNRVU.ts";

A simple and tiny router for deno deploy

import { listenAndServe } from "https://deno.land/std/http/server.ts";
import { router } from "https://crux.land/router@0.0.5";

await listenAndServe(
  ":8080",
  router({
    "/": (_req) => new Response("Hello world!", { status: 200 }),
  }),
);
function router(
routes: Routes,
error?: ErrorHandler,
unknownMethod?: UnknownMethodHandler,
): RequestHandler;
§
router(routes: Routes, other?: RequestHandler, error?: ErrorHandler, unknownMethod?: UnknownMethodHandler): RequestHandler
[src]

§Parameters

§
routes: Routes
[src]

A record of all routes and their corresponding handler functions

§
other?: RequestHandler optional
[src]
§
error?: ErrorHandler optional
[src]
§
unknownMethod?: UnknownMethodHandler optional
[src]

§Return Type

§

A deno deploy compatible request handler