-
-
Save regedarek/30b2f35e92a7f98f4e20 to your computer and use it in GitHub Desktop.
This file contains 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'); | |
colors = require('colors'), | |
pivotal = require('pivotal'); | |
path = require('path'); | |
require('underscore') | |
var app = express.createServer(); | |
app.configure(function () { | |
app.use(express.logger('dev')); /* 'default', 'short', 'tiny', 'dev' */ | |
app.use(express.bodyParser()); | |
app.use(express.static(path.join(__dirname, 'public'))); | |
}); | |
app.get('/delivered_stories', function(request, response) { | |
pivotal.useToken("mytoken"); | |
pivotal.getProjects(function (err, data) { | |
var project_ids = data.project.map(function(x) { return parseInt(x.id); }); | |
console.log('Retrived project ids: '.blue + project_ids); | |
project_ids.forEach(function(id) { | |
pivotal.getStories(id, { filter: "state:finished" }, function(err, story) { | |
response.send(story); | |
}); | |
}); | |
response.end(); // End the JSON array and response. | |
}); | |
}); | |
var port = process.env.PORT || 5000; | |
app.listen(port, function() { | |
console.log("Listening on " + port); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment