-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
41 lines (31 loc) · 1.08 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
// const winston = require('winston');
// const express = require('express');
// const app = express();
// require('./startup/logging')();
// require('./startup/routes')(app);
// require('./startup/db')();
// require('./startup/config')();
// require('./startup/validation')();
// // PORT
// const port = process.env.PORT || 3000;
// const server = app.listen(port, () => winston.info(`Listening on port ${port}...`));
// module.exports = server;
const express = require('express');
const winston = require('winston');
const app = express();
require('./startup/logging')();
require('./startup/routes')(app);
require('./startup/db')();
require('./startup/config')();
require('./startup/validation')();
const port = process.env.PORT || 3000;
const server = app.listen(port, () => winston.info(`Listening on port ${port}...`));
process.on('uncaughtException', (ex) => {
winston.error('We got an uncaught exception: ', ex);
process.exit(1);
});
process.on('unhandledRejection', (ex) => {
winston.error('We got an unhandled rejection: ', ex);
process.exit(1);
});
module.exports = server;