1
- var http = require ( 'http' ) ,
1
+ const
2
+ bodyParser = require ( 'body-parser' ) ;
2
3
fs = require ( 'fs' ) ,
3
4
path = require ( 'path' ) ,
4
5
spawn = require ( 'child_process' ) . spawn ,
5
6
express = require ( 'express' ) ,
6
7
pod = require ( '../lib/api' ) ,
7
8
ghURL = require ( 'parse-github-url' ) ,
8
- app = express ( )
9
+ app = express ( ) ,
10
+ favicon = require ( 'serve-favicon' ) ,
11
+ statics = require ( 'serve-static' )
9
12
10
13
// late def, wait until pod is ready
11
14
var conf
@@ -25,10 +28,11 @@ var auth = express.basicAuth(function (user, pass) {
25
28
app . configure ( function ( ) {
26
29
app . set ( 'views' , __dirname + '/views' )
27
30
app . set ( 'view engine' , 'ejs' )
28
- app . use ( express . favicon ( ) )
31
+ app . use ( favicon ( ) )
29
32
app . use ( reloadConf )
30
33
app . use ( app . router )
31
- app . use ( express . static ( path . join ( __dirname , 'static' ) ) )
34
+ app . use ( bodyParser . json ( ) )
35
+ app . use ( statics ( path . join ( __dirname , 'static' ) ) )
32
36
} )
33
37
34
38
app . get ( '/' , auth , function ( req , res ) {
@@ -47,7 +51,7 @@ app.get('/json', auth, function (req, res) {
47
51
} )
48
52
} )
49
53
50
- app . post ( '/hooks/:appid' , express . bodyParser ( ) , function ( req , res ) {
54
+ app . post ( '/hooks/:appid' , function ( req , res ) {
51
55
var appid = req . params . appid ,
52
56
payload = JSON . stringify ( req . body ) ,
53
57
app = conf . apps [ appid ]
0 commit comments