2013-12-30 02:03:29 -05:00
|
|
|
var frontend = require('../controllers/frontend');
|
|
|
|
|
2013-11-12 00:27:12 -05:00
|
|
|
module.exports = function (server) {
|
2013-12-30 02:03:29 -05:00
|
|
|
/*jslint regexp: true */
|
|
|
|
|
2013-11-12 00:27:12 -05:00
|
|
|
// ### Frontend routes
|
|
|
|
/* TODO: dynamic routing, homepage generator, filters ETC ETC */
|
|
|
|
server.get('/rss/', frontend.rss);
|
|
|
|
server.get('/rss/:page/', frontend.rss);
|
|
|
|
server.get('/page/:page/', frontend.homepage);
|
2013-12-30 02:03:29 -05:00
|
|
|
// Only capture the :slug part of the URL
|
|
|
|
// This regex will always have two capturing groups,
|
|
|
|
// one for date, and one for the slug.
|
|
|
|
// Examples:
|
|
|
|
// Given `/plain-slug/` the req.params would be ['', 'plain-slug']
|
|
|
|
// Given `/2012/12/24/plain-slug/` the req.params would be ['2012/12/24', 'plain-slug']
|
|
|
|
server.get(/^\/([0-9\/]*)([^\/.]*)\/$/, frontend.single);
|
2013-11-12 00:27:12 -05:00
|
|
|
server.get('/', frontend.homepage);
|
2013-12-30 02:03:29 -05:00
|
|
|
};
|