Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/neo-ciber94/keiro
A WinterGC compilant file system router middleware
https://github.com/neo-ciber94/keiro
bun deno fetch file-system-routing nodejs routing
Last synced: about 2 months ago
JSON representation
A WinterGC compilant file system router middleware
- Host: GitHub
- URL: https://github.com/neo-ciber94/keiro
- Owner: Neo-Ciber94
- License: mit
- Created: 2024-06-25T02:01:39.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-19T21:51:45.000Z (5 months ago)
- Last Synced: 2024-10-12T07:15:45.075Z (2 months ago)
- Topics: bun, deno, fetch, file-system-routing, nodejs, routing
- Language: TypeScript
- Homepage: https://neo-ciber94.github.io/keiro/
- Size: 1.63 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# keiro
[![CI](https://github.com/Neo-Ciber94/keiro/actions/workflows/ci.yml/badge.svg)](https://github.com/Neo-Ciber94/keiro/actions/workflows/ci.yml)
[![npm version](https://badge.fury.io/js/keiro.svg)](https://badge.fury.io/js/keiro)
[![Bundle size](https://pkg-size.dev/badge/bundle/243)](https://pkg-size.dev/keiro)A file-system router compatible with [WinterGC](https://wintercg.org/).
## ⚡ Features
- Middlewares
- Request Locals
- Worker Threads## 📖 Check out the [Docs](https://neo-ciber94.github.io/keiro/)
## 📦 Examples
```ts
// src/routes/index.ts
import { defineHandler } from "keiro";export default defineHandler(() => {
return new Response("Hello World");
});
```### 🐢 Node
```ts
// 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
```ts
// 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}`);
```