Repository
Current version released
3 years ago
Versions
Inspirus
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
:
import { App } from "https://deno.land/x/inspirus@1.0.0/min.ts";
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
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D