-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.js
More file actions
24 lines (20 loc) · 682 Bytes
/
server.js
File metadata and controls
24 lines (20 loc) · 682 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
const app = require('./app');
const {application} = require('./configuration/appConfiguration');
const dbConnect = require('./configuration/databaseConfiguration');
/** Initialize Database Connection */
dbConnect();
/** Assinging the PORT */
const PORT = application.port || 5000;
/** Creating a Server */
const server = app.listen(PORT, () => {
console.log(
'\nServer running at ' +
`http://${application.host}:${PORT}/`.green.underline.bold +
` in ${application.env} mode!`
);
});
/** Handle Unhandled Exception */
process.on('unhandledRejection', (err, promises) => {
console.log(`Error: ${err.message}`.red);
server.close(() => process.exit(1));
});