-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
35 lines (26 loc) · 844 Bytes
/
app.js
File metadata and controls
35 lines (26 loc) · 844 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
25
26
27
28
29
30
31
32
33
34
35
var bodyParser = require('body-parser'),
winston = require('winston'),
chalk = require('chalk'),
morgan = require('morgan');
var coreHandler = require('./core'),
xhub = require('express-x-hub');
exports.init = function ( app ) {
winston.debug(chalk.dim('Setting server options...'));
app.enable('trust proxy');
app.disable('x-powered-by');
winston.debug(chalk.dim('Setting up middleware...'));
var logRoute = process.env.environment === 'test' ? process.env.verboseLogging : true;
if( logRoute ) {
app.use( morgan('dev') );
}
app.use(xhub({
algorithm: 'sha1',
secret: require('./config/server').githubSecret
}));
app.use( bodyParser.json() );
app.use(bodyParser.urlencoded({
extended: true
}));
app.post('/notify-push', coreHandler.pushed);
return app;
};