Skip to content

Repository files navigation

Deserve

Build HTTP server effortlessly with zero configuration for productivity.

DenoJSRCILicense

Installation

Note

Prerequisites:Deno 2.8.3 or later.

# Add Deserve from JSR
deno add jsr:@neabyte/deserve

See the installation guide for details.

Quick Start

Create a routes directory and export HTTP method handlers. Start the server.

import{Router}from'@neabyte/deserve'// Create router pointing at routes directoryconstrouter=newRouter({routes: {directory: './routes'}})// Optional worker pool for CPU-bound work// const router = new Router({// routes: { directory: './routes' },// worker: { scriptURL: import.meta.resolve('./worker.ts'), poolSize: 4 }// })// Read handle: ctx.get.worker()// Start server on port 8000awaitrouter.serve(8000)

Example route in routes/hello.ts:

importtype{Context}from'@neabyte/deserve'// Export GET, POST, PUT, path from file locationexportfunctionGET(ctx: Context): Response{returnctx.send.json({message: 'Hello from Deserve'})}

Build & Test

From the repo root (requires Deno).

Check - format, lint, and typecheck:

# Format, lint, and typecheck source
deno task check

Test - run tests (under tests/, uses --allow-read --allow-net):

# Run tests in tests/ (uses --allow-read --allow-net)
deno task test

Benchmark - autocannon runs. benchmark/README.md for details.

Documentation

Full documentation (EN / ID): docs-deserve.neabyte.com

DVE Editor (Syntax Highlighting)

Contributing

License

This project is licensed under the MIT license. See LICENSE for details.

Releases

Contributors

Languages