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
|
|
|
|
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:
|
2014-01-01 09:31:29 -05:00
|
|
|
// Given `/plain-slug/` the req.params would be [undefined, 'plain-slug']
|
2014-01-01 10:27:39 -05:00
|
|
|
// Given `/2012/12/24/plain-slug/` the req.params would be ['2012/12/24/', 'plain-slug']
|
2014-01-01 06:17:35 -05:00
|
|
|
server.get(/^\/([0-9]{4}\/[0-9]{2}\/[0-9]{2}\/)?([^\/.]*)\/$/, frontend.single);
|
2013-11-12 00:27:12 -05:00
|
|
|
server.get('/', frontend.homepage);
|
2013-12-30 02:03:29 -05:00
|
|
|
};
|