-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
40 lines (33 loc) · 985 Bytes
/
index.js
File metadata and controls
40 lines (33 loc) · 985 Bytes
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
import cool from 'cool-ascii-faces';
import express from 'express';
import cors from 'cors';
import morgan from 'morgan';
import dotenv from 'dotenv';
import swagger from 'swagger-ui-express';
import routers from './server/routers';
import swaggerJson from './swagger';
const path = require('path');
dotenv.config();
const app = express();
const PORT = process.env.PORT || 5000;
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(cors());
app.use(morgan('short'));
app.use('/api/v2/', routers);
app.use('/docs/v2/', swagger.serve, swagger.setup(swaggerJson));
app.use((request, response) => {
response.status(404).send({
status: 404,
error: 'Not Found !',
});
});
server.listen(PORT, () => {
// eslint-disable-next-line
console.log(`Server is successfully running on port ${PORT}/`);
});
/*app.listen(PORT, () => {
console.log(`Server started successfully on port ${PORT}`);
}); */
export default app;
/*export default server;*/