25 lines
533 B
TypeScript
25 lines
533 B
TypeScript
import { Elysia } from "elysia";
|
|
import cors from "@elysiajs/cors";
|
|
|
|
const app = new Elysia().use(
|
|
cors({
|
|
origin: ["http://127.0.0.1:3000", "http://localhost:3000"],
|
|
credentials: true,
|
|
}),
|
|
);
|
|
|
|
app.get("/", () => ({
|
|
service: "landing-backend",
|
|
status: "ok",
|
|
}));
|
|
|
|
app.get("/health", () => ({
|
|
status: "ok",
|
|
}));
|
|
|
|
const port = Number(process.env.PORT ?? 4000);
|
|
const hostname = process.env.HOST ?? "127.0.0.1";
|
|
const server = app.listen({ port, hostname });
|
|
|
|
console.log(`Backend listening on ${server.server!.url}`);
|