server as netlify function

This commit is contained in:
Matteo Rosati
2026-01-26 15:22:24 +01:00
parent 2d90ce676b
commit a9170932e7
5 changed files with 13 additions and 11846 deletions

View File

@@ -0,0 +1,29 @@
import { Hono } from "hono";
import { cors } from "hono/cors";
import { RegisterController } from "@/controllers/register";
import { LoginController } from "@/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);