Spaces:
Runtime error
Runtime error
| import cors from "cors"; | |
| import dotenv from "dotenv"; | |
| import express from "express"; | |
| import pinoHttp from "pino-http"; | |
| import swaggerUi from "swagger-ui-express"; | |
| import { APP_CONFIG } from "./config/app.config"; | |
| import rootRouter from "./routes/root.routes"; | |
| import { logger } from "./utils/logger"; | |
| import { swaggerDocs } from "./utils/swagger"; | |
| import privateRouter from "./routes/private.routes"; | |
| import { setupCronJobs } from "./shared/services/cronJobs"; | |
| dotenv.config(); | |
| const app = express(); | |
| app.use(pinoHttp({ logger })); | |
| app.use(cors()); | |
| app.use(express.json()); | |
| app.use("/api-docs", swaggerUi.serve, swaggerUi.setup(swaggerDocs)); | |
| app.use("/", rootRouter); | |
| app.listen(APP_CONFIG.port, () => { | |
| logger.info(`Server is running at ${APP_CONFIG.appURL} in ${APP_CONFIG.env} mode`); | |
| }); | |
| // Private server setup | |
| const privateServer = express(); | |
| privateServer.use(cors()); | |
| privateServer.use(express.json()); | |
| privateServer.use("/private", privateRouter); | |
| setupCronJobs(); | |
| privateServer.listen(APP_CONFIG.privatePort, () => { | |
| logger.info(`Private server is running at ${APP_CONFIG.privateURL} in ${APP_CONFIG.env} mode`); | |
| }); | |