Skip to main content
Deno 2 is finally here 🎉️
Learn more

httpserv

Tiny and fast http server for Deno

Static route example

const server = listen(PORT, HOSTNAME);

server.expose({
  path: "/api",
  handler: () => {
    return new Response("Hello from Api!");
  },
});

Named route example

server.expose({
  path: "/id/:id",
  method: "POST",
  handler: ({ searchString, urlParams }) => {
    console.log("searchString: ", searchString);
    console.log("urlParams: ", urlParams);
    return new Response("Hello from Api!");
  },
});

Wildcard route example

server.expose({
  path: "/path/**",
  handler: ({ searchString, urlParams }) => {
    console.log("searchString: ", searchString);
    console.log("urlParams: ", urlParams);
    return new Response("Hello from Api!");
  },
});

Uses Radix3 router.