aboutsummaryrefslogtreecommitdiffhomepage
path: root/pkgs/server/src/index.ts
blob: 54c1059301e8dad9de5428d1c6ea620d641de2c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { serve } from "@hono/node-server";
import { Hono } from "hono";
import { errorHandler } from "./middleware/error-handler";

const app = new Hono();

app.onError(errorHandler);

app.get("/", (c) => {
	return c.json({ message: "Kioku API" });
});

app.get("/api/health", (c) => {
	return c.json({ status: "ok" });
});

const port = Number(process.env.PORT) || 3000;
console.log(`Server is running on port ${port}`);

serve({
	fetch: app.fetch,
	port,
});

export { app };