-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathapp.js
More file actions
37 lines (29 loc) · 848 Bytes
/
app.js
File metadata and controls
37 lines (29 loc) · 848 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
36
37
/*
App JS
Developer:
Luis Matute - luis.matute@me.com
Description:
This is the server configuration.
*/
var express = require('express'),
http = require('http'),
app = express();
// all environments
app.set('port', process.env.PORT || 80);
app.get('/', function (req, res, next) {
res.send('Hello World!')
})
app.post('/deploy/', function (req, res) {
var spawn = require('child_process').spawn,
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'));
});