-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
29 lines (22 loc) · 836 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
import express from 'express';
import cors from 'cors';
import swaggerUi from 'swagger-ui-express';
import AllExceptionHandler from './src/common/exceptions/all-exception.handler.js';
import NotFoundHandler from './src/common/exceptions/not-found.handler.js';
import AllRoutes from './src/app.routes.js';
import './src/common/configs/sequelize.config.js';
const RunServer = () => {
const app = express();
const port = process.env.PORT;
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
app.use(cors());
// app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
app.use('/api', AllRoutes);
NotFoundHandler(app);
AllExceptionHandler(app);
app.listen(port, () => {
console.log(`server run on port ${port}`);
})
}
export default RunServer;