-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
37 lines (30 loc) · 1022 Bytes
/
index.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
36
37
const express = require("express");
const http = require("http");
const dotenv = require("dotenv");
const app = express();
const database = require("./config/database");
const swaggerUi = require('swagger-ui-express');
const swaggerDocument = require('./swagger.yaml');
const path = require('path');
const cors = require('cors');
database();
app.use(cors())
dotenv.config();
app.use(express.json());
app.use(express.urlencoded({
extended: true
}));
const routes = require("./routes");
app.use(express.json());
app.use(express.urlencoded({
extended: true
}));
app.use('/documentation', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
app.use("/uploads", express.static(path.join(__dirname, 'uploads')));
// app.use("/uploads", express.static(path.join("uploads")))
// app.use("/uploads", express.static("uploads"))
routes(app);
const port = process.env.PORT || 7600;
const server = http.createServer(app);
server.listen(port, () => console.log(`App is listening on port ${port}!`));
module.exports = app;