| import express from "express"; |
| import path from "path"; |
| import { fileURLToPath } from "url"; |
|
|
| import chatRouter from "./routes/chat.js"; |
| import imageRouter from "./routes/image.js"; |
| import searchRouter from "./routes/search.js"; |
| import audioRouter from "./routes/audio.js"; |
| import titleRouter from "./routes/title.js"; |
| import agentRouter from "./routes/agent.js"; |
| import uploadRouter from "./routes/upload.js"; |
| import proxyRouter from "./routes/proxy.js"; |
|
|
| const __filename = fileURLToPath(import.meta.url); |
| const __dirname = path.dirname(__filename); |
|
|
| const app = express(); |
| const PORT = process.env.PORT || 7860; |
|
|
| app.use(express.json({ limit: "12mb" })); |
|
|
| app.use("/api", chatRouter); |
| app.use("/api", imageRouter); |
| app.use("/api", searchRouter); |
| app.use("/api", audioRouter); |
| app.use("/api", titleRouter); |
| app.use("/api", agentRouter); |
| app.use("/api", uploadRouter); |
| app.use("/api", proxyRouter); |
|
|
| app.get("/api/health", (_req, res) => res.json({ ok: true, app: "Genisi" })); |
|
|
| app.use(express.static(path.join(__dirname, "public"))); |
| app.get("*", (_req, res) => res.sendFile(path.join(__dirname, "public", "index.html"))); |
|
|
| app.listen(PORT, "0.0.0.0", () => console.log(`Genisi running on http://0.0.0.0:${PORT}`)); |
|
|