keiro
v0.0.1-beta4
Published
A filesystem routing middleware
Downloads
7
Maintainers
Readme
keiro
A file-system router compatible with WinterGC.
⚡ Features
- Middlewares
- Request Locals
- Worker Threads
📖 Check out the Docs
📦 Examples
// src/routes/index.ts
import { defineHandler } from "keiro";
export default defineHandler(() => {
return new Response("Hello World");
});
🐢 Node
// src/main.ts
import express from "express";
import { fileSystemRouter } from "keiro/node";
const port = Number(process.env.PORT ?? 5022);
const origin = `http://localhost:${port}`;
const app = express();
app.use(fileSystemRouter({ origin }));
app.listen(port, () => {
console.log(`Listening on http://localhost:${port}`);
});
🌐 Web
// src/main.ts
import { fileSystemRouter } from "keiro/web";
const port = Number(process.env.PORT ?? 5021);
const server = Bun.serve({
port,
fetch: fileSystemRouter(),
});
console.log(`Listening on http://${server.hostname}:${server.port}`);