Skip to content

Commit

Permalink
simplify readme example
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanThatOneKid committed Apr 1, 2024
1 parent f6e51c3 commit d6a8fa5
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ Minimal HTTP router library based on the `URLPattern` API.
```ts
import { createRouter } from "@fartlabs/rtx";

if (import.meta.main) {
const router = createRouter()
.get<"id">("/animals/:id", (ctx) => {
return new Response(`Animal ID: ${ctx.params.id}`);
})
.default(() => new Response("Not found", { status: 404 }));

Deno.serve((request) => router.fetch(request));
}
const router = createRouter()
.get("/", () => {
return new Response("Hello, World!");
})
.default(() => new Response("Not found", { status: 404 }));

Deno.serve((request) => router.fetch(request));
```

### Deno
Expand Down

0 comments on commit d6a8fa5

Please sign in to comment.