Skip to content

Commit b34ece0

Browse files
committedMar 12, 2018
Updated with fork
1 parent 22c6a23 commit b34ece0

15 files changed

+192
-901
lines changed
 

‎.jshintrc

-3
This file was deleted.

‎.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v9.8.0

‎Dockerfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM node:9.8.0-alpine
2+
RUN mkdir -p /usr/src/app
3+
WORKDIR /usr/src/app
4+
5+
ENV NODE_ENV production
6+
7+
COPY package.json yarn.lock /usr/src/app/
8+
RUN yarn install --production
9+
10+
COPY . /usr/src/app
11+
12+
CMD npm start

‎LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015 Andrew Nesbitt
3+
Copyright (c) 2015 Mauro Pompilio
44

55
Permission is hereby granted, free of charge, to any person obtaining
66
a copy of this software and associated documentation files (the

‎Procfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: DEBUG=firehose node app.js
1+
web: node app.js

‎README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Libraries Firehose
1+
# 24 Pull Requests Firehose
22

3-
Server sent event bridge for the [Libraries.io](https://libraries.io) events firehose.
3+
Server sent event bridge for the [24 Pull Requests](https://24pullrequests.com) events firehose.
44

55
## Development
66

7-
Source hosted at [GitHub](http://github.com/librariesio/firehose).
8-
Report issues/feature requests on [GitHub Issues](http://github.com/librariesio/firehose/issues). Follow us on Twitter [@librariesio](https://twitter.com/librariesio). We also hangout on [Gitter](https://gitter.im/librariesio/support).
7+
Source hosted at [GitHub](http://github.com/24pullrequests/firehose).
8+
Report issues/feature requests on [GitHub Issues](http://github.com/24pullrequests/firehose/issues). Follow us on Twitter [@24pullrequests](https://twitter.com/24pullrequests). We also hangout on [Gitter](https://gitter.im/24pullrequests/24pullrequests).
99

1010
### Note on Patches/Pull Requests
1111

@@ -19,4 +19,4 @@ Report issues/feature requests on [GitHub Issues](http://github.com/librariesio/
1919

2020
## Copyright
2121

22-
Copyright (c) 2015 Andrew Nesbitt. See [LICENSE](https://github.com/librariesio/firehose/blob/master/LICENSE) for details.
22+
Copyright (c) 2015 Mauro Pompilio. See [LICENSE](https://github.com/24pullrequests/firehose/blob/master/LICENSE) for details.

‎app.js

+3-11
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
1-
/*jshint strict:true, trailing:false, unused:true, node:true */
2-
'use strict';
3-
4-
require("babel/register");
5-
61
var express = require('express');
72
var bodyParser = require('body-parser');
8-
var serve_static = require('serve-static');
9-
var debug = require('debug')('firehose');
103
var router = require('./lib/router');
114
var cors = require('cors')
125

136
var app = express();
147
app.use(bodyParser.json());
15-
app.use(serve_static('static'));
16-
app.use(bodyParser.urlencoded({
17-
extended: true
8+
app.use(bodyParser.urlencoded({
9+
extended: true
1810
}));
1911

2012
app.post('/events', router.firehose.rx);
2113
app.get('/events', cors(), router.firehose.tx);
2214

2315
var port = process.env.PORT || 5001;
2416
app.listen(port, function() {
25-
debug('Listening on', port);
17+
console.log('Listening on', port);
2618
});

‎lib/router/firehose.js

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
/*jshint strict:true, trailing:false, unused:true, node:true */
2-
'use strict';
3-
4-
require("babel/register");
5-
61
var EventEmitter = require('eventemitter3');
72
var emitter = new EventEmitter();
83

94
var rx = function(req, res) {
10-
if(req.query.api_key === process.env.API_KEY){
5+
if(req.query.api_key === process.env.API_KEY) {
116
var data = req.body;
12-
emitter.emit('pullRequest', data);
7+
emitter.emit('pkg', data);
138
}
149
res.end();
1510
};
@@ -22,21 +17,23 @@ var tx = function(req, res) {
2217
});
2318

2419
// Heartbeat
25-
var nln = () => res.write('\n');
20+
var nln = function() {
21+
res.write('\n');
22+
}
2623
var hbt = setInterval(nln, 15000);
2724

28-
var onPullRequest = (data) => {
25+
var onPkg = function(data){
2926
res.write("retry: 500\n");
30-
res.write(`event: pullRequest\n`);
27+
res.write(`event: event\n`);
3128
res.write(`data: ${JSON.stringify(data)}\n\n`);
3229
};
3330

34-
emitter.on('pullRequest', onPullRequest);
31+
emitter.on('pkg', onPkg);
3532

3633
// Clear heartbeat and listener
37-
req.on('close', () => {
34+
req.on('close', function() {
3835
clearInterval(hbt);
39-
emitter.removeListener('pullRequest', onPullRequest);
36+
emitter.removeListener('pkg', onPkg);
4037
});
4138
};
4239

‎lib/router/index.js

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/*jshint strict:true, trailing:false, unused:true, node:true */
2-
'use strict';
3-
41
module.exports = {
52
firehose: require('./firehose')
63
};

‎package.json

+8-12
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
{
22
"name": "firehose",
33
"version": "1.0.0",
4-
"description": "Libraries Firehose",
4+
"description": "24 Pull Requests Firehose",
55
"main": "app.js",
66
"engines": {
7-
"node": "0.12.x"
7+
"node": "9.8.0"
88
},
99
"scripts": {
10-
"start": "DEBUG=firehose nodemon app.js",
11-
"test": "echo \"Error: no test specified\" && exit 1"
10+
"start": "node app.js"
1211
},
1312
"author": "Mauro Pompilio",
14-
"license": "Private",
13+
"license": "MIT",
1514
"dependencies": {
16-
"babel": "^4.7.16",
17-
"body-parser": "^1.12.2",
18-
"cors": "^2.5.3",
19-
"debug": "^2.1.3",
20-
"eventemitter3": "^0.1.6",
21-
"express": "^4.12.3",
22-
"serve-static": "^1.9.2"
15+
"body-parser": "^1.14.1",
16+
"cors": "^2.7.1",
17+
"eventemitter3": "^1.2.0",
18+
"express": "^4.13.3"
2319
}
2420
}

‎static/demo.html

-32
This file was deleted.

‎static/favicon.ico

-33.7 KB
Binary file not shown.

‎static/main.css

-149
This file was deleted.

‎static/main.js

-55
This file was deleted.

‎yarn.lock

+151-616
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.