https://github.com/virakkhun/cooed
yet another http routing ๐
https://github.com/virakkhun/cooed
api deno http-server routing server web
Last synced: about 1 month ago
JSON representation
yet another http routing ๐
- Host: GitHub
- URL: https://github.com/virakkhun/cooed
- Owner: virakkhun
- License: mit
- Created: 2024-12-23T15:59:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-07T14:30:51.000Z (12 months ago)
- Last Synced: 2025-10-07T13:47:53.590Z (9 months ago)
- Topics: api, deno, http-server, routing, server, web
- Language: TypeScript
- Homepage:
- Size: 15.5 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cooed ๐ฆ
cooed is a simple and minimal http routing library, to handle request `Request`
from Deno.serve.
features:
- routing ๐
- group ๐
- middleware ๐ฅท
- static ๐๏ธ
> example:
here is the small server setup to handle request from Deno.serve.
```ts
import { Cooed, RequestHandler, Static } from "@cooed/router";
const server = new Cooed({
static: new Static({
// dist is the location where the static content located
dir: "dist",
}),
});
const middleware: RequestHandler = (ctx) => {
if (ctx.request.method === "GET") {
return ctx.response.badRequest();
}
return next;
};
server.get("/", middleware, (ctx) => {
return ctx.response.json("Hello world!!").send();
});
const client = server.group("/client");
client.get("/", () => new Response("Hello client"));
// listen to Request through Deno.serve
Deno.serve({ port: 8000 }, async (req) => await server.serve(req));
```
๐งพ License
MIT License
Copyright (c) 2024 Virak Khun