-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
35 lines (27 loc) · 783 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import "dotenv/config";
import express from "express";
import cors from "cors";
import morgan from "morgan";
import routesCountry from "./routes/rCountry.js";
import connectDB from "./config/db.js";
import swaggerUi from "swagger-ui-express";
import swaggerFile from "./swagger/swagger-output.json" assert { type: "json" };
connectDB();
const app = express();
const PORT = 3000;
app.set("view engine", "ejs");
app.use(
cors({
accessControlAllowOrigin: "*",
})
);
app.use(morgan("dev"));
app.use(express.json());
app.get("/", (req, res) => {
res.render("index");
});
app.use("/venezuela", routesCountry);
app.use("/docs", swaggerUi.serve, swaggerUi.setup(swaggerFile));
app.listen(PORT, () => {
console.log(`Iniciando express desde http://localhost:${PORT}`);
});