2014-03-24 01:49:43 +04:00
|
|
|
var frontend = require('../controllers/frontend'),
|
|
|
|
config = require('../config'),
|
|
|
|
|
|
|
|
ONE_HOUR_S = 60 * 60,
|
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 16:41:19 +04:00
|
|
|
ONE_YEAR_S = 365 * 24 * ONE_HOUR_S,
|
2013-12-30 11:03:29 +04: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 16:41:19 +04:00
|
|
|
frontendRoutes;
|
|
|
|
|
|
|
|
frontendRoutes = function (server) {
|
2014-03-24 01:49:43 +04:00
|
|
|
var subdir = config().paths.subdir;
|
2013-12-30 11:03:29 +04:00
|
|
|
|
2013-11-12 09:27:12 +04:00
|
|
|
// ### Frontend routes
|
|
|
|
server.get('/rss/', frontend.rss);
|
|
|
|
server.get('/rss/:page/', frontend.rss);
|
2014-03-24 01:49:43 +04:00
|
|
|
server.get('/feed/', function redirect(req, res) {
|
|
|
|
/*jshint unused:true*/
|
|
|
|
res.set({'Cache-Control': 'public, max-age=' + ONE_YEAR_S});
|
|
|
|
res.redirect(301, subdir + '/rss/');
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2014-03-06 02:03:39 +04:00
|
|
|
server.get('/tag/:slug/rss/', frontend.rss);
|
|
|
|
server.get('/tag/:slug/rss/:page/', frontend.rss);
|
2014-02-13 07:26:56 +04:00
|
|
|
server.get('/tag/:slug/page/:page/', frontend.tag);
|
|
|
|
server.get('/tag/:slug/', frontend.tag);
|
2013-11-12 09:27:12 +04:00
|
|
|
server.get('/page/:page/', frontend.homepage);
|
|
|
|
server.get('/', frontend.homepage);
|
2014-02-02 09:29:07 +04:00
|
|
|
server.get('*', frontend.single);
|
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 16:41:19 +04:00
|
|
|
};
|
2014-03-24 01:49:43 +04: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 16:41:19 +04:00
|
|
|
module.exports = frontendRoutes;
|