Created
May 31, 2012 05:18
-
-
Save robdodson/2841233 to your computer and use it in GitHub Desktop.
pivotal scraper
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 app = require('express').createServer(); | |
var http = require('http'); | |
var token = 'xxxxxxxxxxxxxxxx'; | |
var projectID = 'xxxxxxxxx'; | |
app.get('/', function(req, res) { | |
res.send('index page!'); | |
}); | |
app.get('/project', function(req, res) { | |
var options = { | |
host: 'www.pivotaltracker.com', | |
port: 80, | |
path: '/services/v3/projects/' + projectID, | |
headers: { | |
'X-TrackerToken': token | |
} | |
}; | |
http.get(options, function(getResponse) { | |
//console.log('STATUS: ' + getResponse.statusCode); | |
//console.log('HEADERS: ' + JSON.stringify(getResponse.headers)); | |
getResponse.setEncoding('utf8'); | |
getResponse.on('data', function (chunk) { | |
console.log(chunk); | |
res.send(chunk); | |
}); | |
}); | |
}); | |
app.listen(3000, function() { | |
console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment