34 lines
718 B
TypeScript
34 lines
718 B
TypeScript
import { Hono } from "hono";
|
|
import { cors } from "hono/cors";
|
|
import { RegisterController } from "@/controllers/register";
|
|
import { LoginController } from "@/controllers/login";
|
|
|
|
const app = new Hono();
|
|
|
|
app.use(
|
|
"/api/v1/*",
|
|
cors({
|
|
origin: "*",
|
|
allowHeaders: ["X-Custom-Header", "Upgrade-Insecure-Requests"],
|
|
allowMethods: ["POST", "GET", "OPTIONS"],
|
|
exposeHeaders: ["Content-Length", "X-Kuma-Revision"],
|
|
maxAge: 600,
|
|
credentials: true,
|
|
}),
|
|
);
|
|
|
|
app.get("/", async (c) => {
|
|
return c.json({
|
|
message: "ok",
|
|
});
|
|
});
|
|
|
|
app.post("/api/v1/register", RegisterController);
|
|
|
|
app.post("/api/v1/login", LoginController);
|
|
|
|
export default {
|
|
port: Bun.env.SERVER_PORT,
|
|
fetch: app.fetch,
|
|
};
|