44
55Build HTTP server effortlessly with zero configuration for productivity.
66
7- [ ![ Deno] ( https://img.shields.io/badge/deno-2.5.4 +-000000?logo=deno&logoColor=white )] ( https://deno.com ) [ ![ JSR] ( https://jsr.io/badges/@neabyte/deserve )] ( https://jsr.io/@neabyte/deserve ) [ ![ CI] ( https://github.com/NeaByteLab/Deserve/actions/workflows/ci.yaml/badge.svg )] ( https://github.com/NeaByteLab/Deserve/actions/workflows/ci.yaml ) [ ![ License] ( https://img.shields.io/badge/license-MIT-blue.svg )] ( LICENSE )
7+ [ ![ Deno] ( https://img.shields.io/badge/deno-2.7.0 +-000000?logo=deno&logoColor=white )] ( https://deno.com ) [ ![ JSR] ( https://jsr.io/badges/@neabyte/deserve )] ( https://jsr.io/@neabyte/deserve ) [ ![ CI] ( https://github.com/NeaByteLab/Deserve/actions/workflows/ci.yaml/badge.svg )] ( https://github.com/NeaByteLab/Deserve/actions/workflows/ci.yaml ) [ ![ License] ( https://img.shields.io/badge/license-MIT-blue.svg )] ( LICENSE )
88
99</div >
1010
1111## Features
1212
13- - ** Zero Config** — No build step. Point to routes and serve.
14- - ** File-Based Routing** — Put route files in a folder, URL follows that structure.
15- - ** Context** — Body, query, params, cookies, headers, plus helpers to respond.
16- - ** Middleware** — Global or per path. CORS, auth, session, WebSocket.
17- - ** Static Files** — Serve directories with optional cache and etag.
18- - ** Error Handling** — Custom or default HTML/JSON error responses.
19- - ** Hot Reload ** — Routes and templates reload automatically when files change .
20- - ** Worker Pool ** — Offload heavy work to a pool so the server stays responsive .
21- - ** Frontend Optional ** — Use any frontend. Deserve stays the server.
13+ - ** Zero Config** - No build step. Point to routes and serve.
14+ - ** File-Based Routing** - Put route files in a folder, URL follows that structure.
15+ - ** Context** - Body, query, params, cookies, headers, plus helpers to respond.
16+ - ** Middleware** - Global or per path. CORS, CSRF, IP , auth, session, WebSocket.
17+ - ** Static Files** - Serve directories with optional cache and etag.
18+ - ** Error Handling** - Custom or default HTML/JSON error responses.
19+ - ** Observability ** - Subscribe to lifecycle, request, and error events .
20+ - ** Hot Reload ** - Routes and templates reload automatically when files change .
21+ - ** Worker Pool ** - Offload heavy work to a pool so the server stays responsive .
2222
2323## Installation
2424
2525> [ !NOTE]
26- > ** Prerequisites:** [ Deno] ( https://deno.com/ ) 2.5.4 or later.
26+ > ** Prerequisites:** [ Deno] ( https://deno.com/ ) 2.7.0 or later.
2727
2828``` bash
2929# Add Deserve from JSR
@@ -39,54 +39,54 @@ Create a routes directory and export HTTP method handlers. Start the server.
3939``` typescript
4040import { Router } from ' jsr:@neabyte/deserve'
4141
42- // Create router and point to your routes directory
42+ // Create router pointing at routes directory
4343const router = new Router ({ routesDir: ' ./routes' })
4444
45- // Optional: enable worker pool for CPU-bound work (ctx.state.worker.run(payload) in routes)
45+ // Optional worker pool for CPU-bound work
4646// const router = new Router({
4747// routesDir: './routes',
4848// worker: { scriptURL: import.meta.resolve('./worker.ts'), poolSize: 4 }
4949// })
50+ // Read handle: ctx.getState('worker' as never)
5051
5152// Start server on port 8000
5253await router .serve (8000 )
5354```
5455
55- ** Example route** — ` routes/hello.ts ` :
56+ ** Example route** in ` routes/hello.ts ` :
5657
5758``` typescript
5859import type { Context } from ' jsr:@neabyte/deserve'
5960
60- // Export GET (or POST, PUT, etc.) — path comes from file location
61- export function GET(ctx : Context ) {
61+ // Export GET, POST, PUT, path from file location
62+ export function GET(ctx : Context ): Response {
6263 return ctx .send .json ({ message: ' Hello from Deserve' })
6364}
6465```
6566
6667- [ Quick Start (Docs)] ( https://docs-deserve.neabyte.com/en/getting-started/quick-start )
6768- [ File-Based Routing] ( https://docs-deserve.neabyte.com/en/core-concepts/file-based-routing )
68- - [ Hot Reload] ( https://docs-deserve.neabyte.com/en/core-concepts/hot-reload )
6969- [ Example Implementation] ( example/README.md )
7070
7171## Build & Test
7272
7373From the repo root (requires [ Deno] ( https://deno.com/ ) ).
7474
75- ** Check** — format, lint, and typecheck:
75+ ** Check** - format, lint, and typecheck:
7676
7777``` bash
7878# Format, lint, and typecheck source
7979deno task check
8080```
8181
82- ** Test** — run tests (under ` tests/ ` , uses ` --allow-read ` for fixtures):
82+ ** Test** - run tests (under ` tests/ ` , uses ` --allow-read ` for fixtures):
8383
8484``` bash
8585# Run tests in tests/ (uses --allow-read for fixtures)
8686deno task test
8787```
8888
89- ** Benchmark** — autocannon runs. [ benchmark/README.md] ( benchmark/README.md ) for details.
89+ ** Benchmark** - autocannon runs. [ benchmark/README.md] ( benchmark/README.md ) for details.
9090
9191## Documentation
9292
@@ -98,9 +98,9 @@ Full documentation (EN / ID): **[docs-deserve.neabyte.com](https://docs-deserve.
9898
9999## Contributing
100100
101- - ** Bugs & ideas** — [ GitHub Issues] ( https://github.com/NeaByteLab/Deserve/issues )
102- - ** Code & docs** — [ Pull Requests] ( https://github.com/NeaByteLab/Deserve/pulls ) welcome.
103- - ** Use it** — Try Deserve in your projects and share feedback.
101+ - ** Bugs & ideas** - [ GitHub Issues] ( https://github.com/NeaByteLab/Deserve/issues )
102+ - ** Code & docs** - [ Pull Requests] ( https://github.com/NeaByteLab/Deserve/pulls ) welcome.
103+ - ** Use it** - Try Deserve in real projects and share feedback.
104104
105105## License
106106
0 commit comments