-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathciServer.js
More file actions
28 lines (21 loc) · 806 Bytes
/
ciServer.js
File metadata and controls
28 lines (21 loc) · 806 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
var express = require('express'),
morgan = require('morgan'),
bodyParser = require('body-parser'),
child = require("child_process"),
app = express();
function gitPull(){
child.exec('cd /srv/ngLazy-demo && touch hooked.success', { detached: true });
child.exec('cd /srv/ngLazy-demo && git pull origin master && npm install && bower install --allow-root && bower update ngLazy --allow-root', { detached: true });
}
app.use(bodyParser());
app.use(morgan({ format: 'dev', immediate: true }));
app.get('/', function(req, res){
res.send(200, "GOTTEN");
});
app.post('/', function(req, res){
console.log(req.body);
req.body.commits[0].distinct && gitPull();
res.send(204);
});
app.listen(8001);
console.log('Server running at http://127.0.0.1:8001/');