30 lines
708 B
TypeScript
30 lines
708 B
TypeScript
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);
|