-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
50 lines (45 loc) · 1.23 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
// NPM Packages
// @ts-ignore
const express = require('express');
// @ts-ignore
const swaggerUi = require('swagger-ui-express');
// @ts-ignore
const cors = require('cors');
// @ts-ignore
const YAML = require('yamljs');
// Local functions
const connectDB = require("./db");
const logger = require('./logger');
connectDB();
const app = express();
// @ts-ignore
app.use(express.json());
// @ts-ignore
app.use(cors());
const port = process.env.PORT || 9999;
const swaggerDocument = YAML.load('./swagger.yml');
// Routes
// @ts-ignore
app.use('/docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
// @ts-ignore
app.use('/api/auth', require('./routes/auth'));
// @ts-ignore
app.use('/api/user', require('./routes/user'));
// @ts-ignore
app.use('/api/post', require('./routes/post'));
// @ts-ignore
app.use('/api/comment', require('./routes/comment'));
// @ts-ignore
app.use('/api/event', require('./routes/event'));
// @ts-ignore
app.use('/api/blog', require('./routes/blog'));
// @ts-ignore
app.use('/api/', require('./routes/common'));
// @ts-ignore
app.get('/', (req, res) => {
res.send('Welcome to the Quinnn Server. Server is running!');
});
// @ts-ignore
app.listen(port, () => {
logger.info(`🚀 Server running on port ${port}`);
});