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

minmi

Minmi is a WIP web toolkit for Deno that sits on top of Deno’s standard HTTP module.

Features

  • Small - just 90 LOC
  • Future-proof - built on top of standard HTTP module
  • 0 dependencies - it’s just Typescript + Deno’s standard library
  • Beginner friendly - the code is so simple that everyone can understand

Examples

import { listenAndServe } from "https://deno.land/std@0.112.0/http/server.ts";
import * as log from "https://deno.land/std@0.112.0/log/mod.ts";
import { Mux } from "../mux.ts";

const addr = ":8080";

// create a new router
const mux = new Mux();

// define a new route handler
const hello = function (_req: Request) {
  return new Response(`Hello, world!`);
};

// add the handler to the path "/" with the method GET
mux.get("/", hello);

// return a handler with the standard (Request) => Response signature to handle all requests
const handler = mux.handler();

try {
  log.info(`HTTP server running at http://localhost${addr}`);
  await listenAndServe(addr, handler);
} catch (err) {
  log.error(err);
}