-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
executable file
·35 lines (27 loc) · 1015 Bytes
/
server.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
const app = require('express')();
const cors = require('cors');
const bodyparser = require('body-parser');
const logger = require('./src/logging/log');
const AppRouteController = require('./src/controllers/AppRouteController');
const morganMiddleware = require('./middleware/morgan');
require('dotenv').config();
const PROCESS = process.env;
const { AUTH_PORT } = PROCESS;
app.use(morganMiddleware);
app.use(bodyparser.json({ limit: '50mb' }));
app.use(bodyparser.urlencoded({ extended: true }));
app.use(cors());
process.on('uncaughtException', (err) => {
logger.error(err);
});
// eslint-disable-next-line no-new
new AppRouteController('v1', app);
global.__basedir = __dirname; //eslint-disable-line
app.listen(AUTH_PORT, () => {
logger.info(`auth server listening at ${AUTH_PORT} and in ${PROCESS.NODE_ENV}`);
/* eslint-disable no-console */
console.log(`auth server listening at ${AUTH_PORT} and in ${PROCESS.NODE_ENV}`);
});
process.on('unhandledRejection', (err) => {
logger.error(err);
});