-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
41 lines (34 loc) · 1.05 KB
/
app.js
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
38
39
40
41
var http = require('http');
var url = require('url');
var express = require('express');
var github = require('./github');
var teamcity = require('./teamcity');
var jira = require('./jira');
var port = process.env.PORT || 3000;
var host = process.env.HOST || 'localhost';
var app = express();
app.use(express.bodyParser());
app.post('/', function (req,res){
var service = req.query.service;
if (service != 'undefined'){
switch(service.toLowerCase()){
case 'github':
github.messageHipchat(req);
break;
case 'teamcity':
teamcity.messageHipchat(req);
break;
case 'jira':
break;
jira.messageHipchat(req);
}
}
else{
console.log('service queryparam not defined.')
}
res.end('done')
});
app.get('/',function(req,res){
res.end('JustSayin is a messaging bot used by JustGiving.com to route messages between systems and internal chat. It cannot be used from a browser.')
});
app.listen(port);