-
Notifications
You must be signed in to change notification settings - Fork 4
/
app.js
33 lines (25 loc) · 812 Bytes
/
app.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
global.__base = __dirname + '/';
require('dotenv').config();
/**
* Require dependencies
*/
const express = require('express');
const passport = require('passport');
const bodyParser = require('body-parser');
const config = require('./config.js');
const logger = require('tracer').colorConsole({level: process.env.LOG_LEVEL || 'debug' });
/**
* Create express APP
*/
const app = express();
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.enable('trust proxy');
require('./core/middleware/authenticated.js')(passport);
// load API routes
require('./core/api/routes.js')(app);
// add error middleware
app.use(require('./core/middleware/error.js'));
app.listen(config.server.port);
logger.info(`Server listening on port : ${config.server.port}`);
module.exports = app;