Skip to content

Instantly share code, notes, and snippets.

@mdb
Created September 28, 2012 22:00
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 mdb/3802298 to your computer and use it in GitHub Desktop.
Save mdb/3802298 to your computer and use it in GitHub Desktop.
module.exports = function(app) {
app.get('/', function(req, res){
console.log(__dirname)
res.render('index', {
title: '2012 PollWatcher'
});
});
app.get('/:state', function(req, res){
console.log(__dirname)
res.redirect('/state/' + req.params.state);
});
app.get('/state/:name', function(req, res){
console.log(__dirname);
getPollData({state: req.params.name}, function (data) {
console.log(data);
res.render('state', {
title: '2012 PollWatcher',
polls: data
});
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment