-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
23 lines (19 loc) · 686 Bytes
/
app.js
File metadata and controls
23 lines (19 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* eslint-disable no-console */
const express = require('express')
const http = require('http')
const app = express()
app.set('port', process.env.PORT || 8080)
app.post('/deploy/', function (req, res) {
const spawn = require('child_process').spawn
const deploy = spawn('sh', ['./deploy.sh'])
deploy.stdout.on('data', function (data) {
console.log(data)
})
deploy.on('close', function (code) {
console.log('Child process exited with code ' + code)
})
res.json(200, {message: 'Github Hook received!'})
})
http.createServer(app).listen(app.get('port'), function () {
console.log('Express server listening on port ' + app.get('port'))
})