-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
43 lines (32 loc) · 1.17 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
42
43
const startupLog = require('debug')('http');
//const dbLog = require('debug')('app:db');
const config = require('config');
const express = require('express');
const helmet = require('helmet');
const morgan = require('morgan');
const Joi = require('joi');
const app = express();
const courses = require('./routes/courses');
const homepage = require('./routes/homepage')
const fundtransfer = require('./routes/fund-transfer');
app.set('view engine', 'pug');
app.set('views', './views');
const logger = require('./logger');
const authenticate = require('./authenticate');
const { urlencoded } = require('express');
app.use(express.json())
app.use(helmet());
app.use('/', homepage);
app.use( '/api/courses', courses);
app.use('/fund-transfer', fundtransfer);
console.log('Application Name: ' + config.get('name'));
console.log('Mail Host Name: ' + config.get('mail.host'));
//app.use( logger);
//app.use( authenticate);
app.use ( express.urlencoded({extended: true}));
app.use( express.static('public'));
app.use(morgan('tiny'));
startupLog('Morgan enabled ...')
//dbLog("Some DB Log...");
const port = process.env.PORT || 3001;
app.listen( port, ()=>console.log(`Listening to ${port}`));