-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
31 lines (19 loc) · 1.07 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
const express = require('express'); //returns object
const app = express(); //in these objects, there are get(), post(), put(), delete() methods
//here i am putting it before rrequire(routes) and require(db). q ki agr koi error aye to sabse pehle winston hi sambhal le.
const { unhandledExc_Rej, logger } = require('./startup/logging.js');
unhandledExc_Rej();
require('./startup/routes.js')(app); // require('./startup/routes') hame ek function dega jisme hum app ko pass kark us function ko call kr denge simple.
const database = require('./startup/db.js')();
require('./startup/config.js')();
//1vvid157-shifting joi and joi-objectId------------------
require('./startup/validation.js')();
//1^-----------------------------------
require('./startup/prod.js')(app); //vid216
// const p = Promise.reject(new Error('Unhandled Promise'));
// p.then(() => console.log('Done'));
// throw new Error('Something worn winston');
const port = process.env.PORT || 3000;
let server;
server = app.listen(port, () => {logger.info(`listening on port ${port}...`)});
module.exports = server;