Skip to main content
Deno 2 is finally here 🎉️
Learn more

Inspirus

DeepScan grade Github license badge Maintenance badge

Zero dependency, tiny web server with routing included.

Example usage

import { App } from "https://deno.land/x/inspirus@1.0.0/mod.ts";

const app = new App({ port: 7784 });

// Inspirus is a routing server with minimal overhead. Based on native Deno's web server.
// Request is type of Deno.Request.
app.listen("GET", "/api/:userId/:opcode?", async (request, params) => {
    const reply = { userId: params["userId"], opcode: params["opcode"] ?? "Unknown" };
    const response = new Response(JSON.stringify(reply));
    
    response.headers.set("Content-Type", "application/json");
    return response;
})

You can also import minified version which takes only 2,7KB: (it won’t support typescript types)

import { App } from "https://deno.land/x/inspirus@1.0.0/min.js";

Performance

Native Web Server Inspirus Web Server
https://raw.githubusercontent.com/Amatsagu/Inspirus/master/.github/native_benchmark.png https://raw.githubusercontent.com/Amatsagu/Inspirus/master/.github/inspirus_benchmark.png
Avg. 40.97K req/sec Avg. 40.56K req/sec

The code comes from https://github.com/denoland/deno_std/blob/main/http/bench.ts. Inspirus version had the same code attached to “/” route.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D