-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathapp.js
44 lines (38 loc) · 1.19 KB
/
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
36
37
38
39
40
41
42
43
44
const express = require('express');
const configRootAPI = require('./config/config.root');
const bodyParser = require('body-parser');
const cors = require('cors');
const logger = require('morgan');
const {
missionRouter,
traineeRoute,
companyRoute,
applicationRoute,
paraData,
adminRoute
} = require('./routers');
const models = require('./models');
const app = express();
const port = process.env.PORT || configRootAPI.port;
app.use(cors());
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(
bodyParser.urlencoded({
extended: true
})
);
app.use(`${configRootAPI.rootAPI}/mission`, missionRouter);
app.use(`${configRootAPI.rootAPI}/trainee`, traineeRoute);
app.use(`${configRootAPI.rootAPI}/company`, companyRoute);
app.use(`${configRootAPI.rootAPI}/paradata`, paraData);
app.use(`${configRootAPI.rootAPI}/application`, applicationRoute);
app.use(`${configRootAPI.rootAPI}/general`, paraData);
app.use(`${configRootAPI.rootAPI}/salutadmin`, adminRoute);
app.use(`${configRootAPI.rootAPI}/public`, express.static('public'));
/* Server Listening */
models.sequelize.sync().then(() => {
app.listen(port);
console.log(`>>Magic happens on port ${port}`);
});
models.exports = app;