-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathapp.js
More file actions
35 lines (23 loc) · 759 Bytes
/
app.js
File metadata and controls
35 lines (23 loc) · 759 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
//Express Params
var express = require("express");
var app = express();
var bodyParser = require('body-parser');
app.use(bodyParser.json()); // to support JSON-encoded bodies
app.use(bodyParser.urlencoded({ // to support URL-encoded bodies
extended: true
}));
app.set('port', process.env.PORT || 7878);
var cmd=require('node-cmd');
app.post('/gitPush', function (req, res) {
console.log("Received the message(from Git) inside gitPush->"+ JSON.stringify(req.body));
cmd.get('bash script.sh',
function(err, data, stderr){
if (!err) {
console.log('Error in Running the Code->',data)
} else {
console.log('error', err)
}
}
);
});
app.listen(app.get('port'));