import express, { type Express } from "express";
import cors from "cors";
import router from "./routes";

const app: Express = express();

app.set("trust proxy", 1);

app.use(cors());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));

app.use("/api", router);

app.get("/", (_req, res) => res.redirect("/api/ui"));
app.get("/api", (_req, res) => res.redirect("/api/ui"));

export default app;
