-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
40 lines (34 loc) · 993 Bytes
/
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
const express = require('express');
const app = express();
const logging = require('./startup/logging');
const ip = require('ip');
const swaggerJsDoc = require('swagger-jsdoc');
const swaggerUi = require('swagger-ui-express');
const options = {
definition: {
swagger: '2.0',
info: {
title: 'Daily Tasks API', // Title (required)
contact: {
name: 'Basit Maqsood',
},
},
},
// Path to the API docs
apis: ['./api/routes/user.js'],
basePath: '/api',
};
const swaggerDocs = swaggerJsDoc(options);
app.use('/docs', swaggerUi.serve, swaggerUi.setup(swaggerDocs));
logging();
require('./api/data/db.js')();
require('./startup/config')();
require('./startup/routes')(app);
require('./startup/prod')(app);
const port = process.env.PORT || 5000;
logging.logger.info('Current Environment: ' + process.env.NODE_ENV);
const server = app.listen(port, () =>
logging.logger.info(
`NIKIST APIs listening on port ${port}! & ip: ${ip.address()}`
)
);