2014-03-23 16:49:43 -05:00
|
|
|
var frontend = require('../controllers/frontend'),
|
|
|
|
config = require('../config'),
|
2014-04-11 22:46:15 -05:00
|
|
|
express = require('express'),
|
2014-07-28 08:19:49 -05:00
|
|
|
utils = require('../utils'),
|
2013-12-30 02:03:29 -05:00
|
|
|
|
Refactor API arguments
closes #2610, refs #2697
- cleanup API index.js, and add docs
- all API methods take consistent arguments: object & options
- browse, read, destroy take options, edit and add take object and options
- the context is passed as part of options, meaning no more .call
everywhere
- destroy expects an object, rather than an id all the way down to the model layer
- route params such as :id, :slug, and :key are passed as an option & used
to perform reads, updates and deletes where possible - settings / themes
may need work here still
- HTTP posts api can find a post by slug
- Add API utils for checkData
2014-05-08 07:41:19 -05:00
|
|
|
frontendRoutes;
|
|
|
|
|
2014-04-11 22:46:15 -05:00
|
|
|
frontendRoutes = function () {
|
|
|
|
var router = express.Router(),
|
2014-07-17 09:33:21 -05:00
|
|
|
subdir = config.paths.subdir;
|
2013-12-30 02:03:29 -05:00
|
|
|
|
2013-11-12 00:27:12 -05:00
|
|
|
// ### Frontend routes
|
2014-04-11 22:46:15 -05:00
|
|
|
router.get('/rss/', frontend.rss);
|
|
|
|
router.get('/rss/:page/', frontend.rss);
|
|
|
|
router.get('/feed/', function redirect(req, res) {
|
2014-03-23 16:49:43 -05:00
|
|
|
/*jshint unused:true*/
|
2014-07-28 08:19:49 -05:00
|
|
|
res.set({'Cache-Control': 'public, max-age=' + utils.ONE_YEAR_S});
|
2014-03-23 16:49:43 -05:00
|
|
|
res.redirect(301, subdir + '/rss/');
|
|
|
|
});
|
|
|
|
|
2014-07-20 11:32:14 -05:00
|
|
|
// Tags
|
2014-04-11 22:46:15 -05:00
|
|
|
router.get('/tag/:slug/rss/', frontend.rss);
|
|
|
|
router.get('/tag/:slug/rss/:page/', frontend.rss);
|
|
|
|
router.get('/tag/:slug/page/:page/', frontend.tag);
|
|
|
|
router.get('/tag/:slug/', frontend.tag);
|
2014-07-20 11:32:14 -05:00
|
|
|
|
|
|
|
// Authors
|
|
|
|
router.get('/author/:slug/rss/', frontend.rss);
|
|
|
|
router.get('/author/:slug/rss/:page/', frontend.rss);
|
|
|
|
router.get('/author/:slug/page/:page/', frontend.author);
|
|
|
|
router.get('/author/:slug/', frontend.author);
|
|
|
|
|
|
|
|
// Default
|
2014-04-11 22:46:15 -05:00
|
|
|
router.get('/page/:page/', frontend.homepage);
|
|
|
|
router.get('/', frontend.homepage);
|
|
|
|
router.get('*', frontend.single);
|
|
|
|
|
|
|
|
return router;
|
Refactor API arguments
closes #2610, refs #2697
- cleanup API index.js, and add docs
- all API methods take consistent arguments: object & options
- browse, read, destroy take options, edit and add take object and options
- the context is passed as part of options, meaning no more .call
everywhere
- destroy expects an object, rather than an id all the way down to the model layer
- route params such as :id, :slug, and :key are passed as an option & used
to perform reads, updates and deletes where possible - settings / themes
may need work here still
- HTTP posts api can find a post by slug
- Add API utils for checkData
2014-05-08 07:41:19 -05:00
|
|
|
};
|
2014-03-23 16:49:43 -05:00
|
|
|
|
2014-09-09 23:06:24 -05:00
|
|
|
module.exports = frontendRoutes;
|