import express, { Express } from "express"; import dotenv from "dotenv"; import bodyParser = require("body-parser"); dotenv.config(); import swaggerJsDoc from "swagger-jsdoc"; const app: Express = express(); const port = process.env.PORT || 3000; import routes from "./src/routes/routes"; import swaggerUI from "swagger-ui-express"; import { initDatabase } from "./src/mongodb/mongodb"; const options = { definition: { openapi: "3.0.0", info: { title: "PartyApp API", version: "1.0.0", //description: "PartyApp API", //termsOfService: "http://example.com/terms/", /*contact: { name: "API Support", url: "http://www.exmaple.com/support", email: "support@example.com", },*/ }, servers: [ { url: "http://localhost:3000", //description: "PartyApp API Documentation", }, ], }, apis: ["./src/routes/api/v1/router/*.ts"], }; app.use(bodyParser.json()); app.use("/api/v1", routes); const specs = swaggerJsDoc(options); app.use("/api-docs", swaggerUI.serve, swaggerUI.setup(specs)); initDatabase(); app.listen(port, () => { console.log(`⚡️[server]: Server is running at http://localhost:${port}`); });