https://github.com/perongh/server-router
Minimalistic router for Deno HTTP server.
https://github.com/perongh/server-router
Last synced: about 2 months ago
JSON representation
Minimalistic router for Deno HTTP server.
- Host: GitHub
- URL: https://github.com/perongh/server-router
- Owner: PeronGH
- Created: 2023-02-28T13:57:31.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-01T16:38:18.000Z (about 2 years ago)
- Last Synced: 2025-01-19T09:42:21.649Z (4 months ago)
- Language: TypeScript
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Server Router
Server Router is a minimalistic router for Deno. It is designed with web standards in mind, and is intended to be used with the [Deno HTTP server](https://deno.land/std/http/server.ts).
### Example
```ts
import { serve } from "https://deno.land/std/http/server.ts";
import { ServerRouter } from "https://deno.land/x/server_router/mod.ts";const router = new ServerRouter();
router
.caseSensitive()
.route("/", (_req) => new Response("Hello World!"))
.route("/api/hi", (_req) => new Response("Hi, API!"));await serve(router.handler);
```