Copied over (with permissions) from http://runnable.com/VAhURy7PJS8iDnUr/plexer-for-codeship-for-node-js
Last active
August 29, 2015 14:06
-
-
Save mlocher/8a9613cc590dfbe5b1e8 to your computer and use it in GitHub Desktop.
Codeship Webhook Multiplexer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
["http://jc-staging-shipper-2005409636.eu-west-1.elb.amazonaws.com"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "shipper-plexer", | |
"version": "0.0.0", | |
"dependencies": { | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express') | |
var app = express() | |
var request = require('request') | |
app.use(require('body-parser').json()) | |
var eps = require('./endpoints.json') | |
app.post('/', function(req, res) { | |
console.log(req.body) | |
eps.forEach(function(url) { | |
request.post({ | |
url: url, | |
json: req.body | |
}, function(err) { | |
if (err) console.error(err) | |
}) | |
}) | |
}) | |
var port = process.env.PORT || 80 | |
app.listen(port) | |
console.log(port) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment