Created
September 28, 2012 22:00
-
-
Save mdb/3802298 to your computer and use it in GitHub Desktop.
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
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