Skip to content

Commit 4739784

Browse files
authored
Fix Webhook - express 3 to 4
1 parent 2a38858 commit 4739784

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

web/app.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
var http = require('http'),
1+
const
2+
bodyParser = require('body-parser');
23
fs = require('fs'),
34
path = require('path'),
45
spawn = require('child_process').spawn,
56
express = require('express'),
67
pod = require('../lib/api'),
78
ghURL = require('parse-github-url'),
8-
app = express()
9+
app = express(),
10+
favicon = require('serve-favicon'),
11+
statics = require('serve-static')
912

1013
// late def, wait until pod is ready
1114
var conf
@@ -25,10 +28,11 @@ var auth = express.basicAuth(function (user, pass) {
2528
app.configure(function () {
2629
app.set('views', __dirname + '/views')
2730
app.set('view engine', 'ejs')
28-
app.use(express.favicon())
31+
app.use(favicon())
2932
app.use(reloadConf)
3033
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')))
3236
})
3337

3438
app.get('/', auth, function (req, res) {
@@ -47,7 +51,7 @@ app.get('/json', auth, function (req, res) {
4751
})
4852
})
4953

50-
app.post('/hooks/:appid', express.bodyParser(), function (req, res) {
54+
app.post('/hooks/:appid', function (req, res) {
5155
var appid = req.params.appid,
5256
payload = JSON.stringify(req.body),
5357
app = conf.apps[appid]

0 commit comments

Comments
 (0)