Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lukeshay/pongjs
A simple router for Cloudflare workers
https://github.com/lukeshay/pongjs
cloudflare cloudflare-workers router
Last synced: about 7 hours ago
JSON representation
A simple router for Cloudflare workers
- Host: GitHub
- URL: https://github.com/lukeshay/pongjs
- Owner: lukeshay
- Created: 2022-12-30T21:43:00.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T15:00:31.000Z (11 months ago)
- Last Synced: 2024-09-17T05:19:14.486Z (about 2 months ago)
- Topics: cloudflare, cloudflare-workers, router
- Language: TypeScript
- Homepage:
- Size: 48.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cloudflare Worker Router
A simple router for Cloudflare workers.
```ts
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](https://www.npmjs.com/package/path-to-regex) for how the paths work.