Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@regedarek
Created March 29, 2013 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save regedarek/30b2f35e92a7f98f4e20 to your computer and use it in GitHub Desktop.
Save regedarek/30b2f35e92a7f98f4e20 to your computer and use it in GitHub Desktop.
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