@pongjs/router
v0.0.6
Published
Simple router for Cloudflare Workers
Downloads
8
Maintainers
Readme
Cloudflare Worker Router
A simple router for Cloudflare workers.
import { router } from "@pongjs/router";
export interface Env {
DB: D1Database;
}
router.add("GET", "/hello/:name", async (request: Request, env: Env) => {
return Response.json({
message: `Hello, ${name}`,
});
});
export default router;
See path-to-regex for how the paths work.