Initialize Minabot with Hono and React Router
This commit is contained in:
23
src/index.ts
Normal file
23
src/index.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Hono } from "hono";
|
||||
import index from "./index.html";
|
||||
|
||||
const app = new Hono();
|
||||
|
||||
app.get("/api/health", c => c.json({ status: "ok" }));
|
||||
app.notFound(c => c.json({ error: "Not found" }, 404));
|
||||
|
||||
const server = Bun.serve({
|
||||
hostname: "127.0.0.1",
|
||||
port: Number(process.env.PORT ?? 3000),
|
||||
routes: {
|
||||
"/api": req => app.fetch(req),
|
||||
"/api/*": req => app.fetch(req),
|
||||
"/*": index,
|
||||
},
|
||||
development: process.env.NODE_ENV !== "production" && {
|
||||
hmr: true,
|
||||
console: true,
|
||||
},
|
||||
});
|
||||
|
||||
console.log(`Server running at ${server.url}`);
|
||||
Reference in New Issue
Block a user