Files
Konquesto/netlify/edge-functions/index.ts
2026-01-26 15:50:21 +01:00

30 lines
724 B
TypeScript

import { Hono } from "hono";
import { cors } from "hono/cors";
import { RegisterController } from "../../src/controllers/register";
import { LoginController } from "../../src/controllers/login";
import { handle } from "hono/netlify";
const app = new Hono().basePath("/api");
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("/", (c) => {
return c.text("Hello Hono!");
});
app.post("/v1/register", RegisterController);
app.post("/v1/login", LoginController);
export default handle(app);