mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
be37070fb6
migration from usage of config() to just an object of config. no relevant issue - Change 'loadConfig' task to 'ensureConfig' to more accurately reflect what it is actually doing. Its sole purpose is to make sure a `config.js` file exists, and as such the name now reflects that purpose. - Update config/index.js to export the ghostConfig object directly so that it can be accessed from other modules - Update all references of config(). to config. This was a blind global find all and replace, treat it as such. - Fixes to tests to support new config access method - Allow each test to still work when invoked invidually
43 lines
No EOL
1.3 KiB
JavaScript
43 lines
No EOL
1.3 KiB
JavaScript
var frontend = require('../controllers/frontend'),
|
|
config = require('../config'),
|
|
express = require('express'),
|
|
|
|
ONE_HOUR_S = 60 * 60,
|
|
ONE_YEAR_S = 365 * 24 * ONE_HOUR_S,
|
|
|
|
frontendRoutes;
|
|
|
|
frontendRoutes = function () {
|
|
var router = express.Router(),
|
|
subdir = config.paths.subdir;
|
|
|
|
// ### Frontend routes
|
|
router.get('/rss/', frontend.rss);
|
|
router.get('/rss/:page/', frontend.rss);
|
|
router.get('/feed/', function redirect(req, res) {
|
|
/*jshint unused:true*/
|
|
res.set({'Cache-Control': 'public, max-age=' + ONE_YEAR_S});
|
|
res.redirect(301, subdir + '/rss/');
|
|
});
|
|
|
|
// Tags
|
|
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);
|
|
|
|
// 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
|
|
router.get('/page/:page/', frontend.homepage);
|
|
router.get('/', frontend.homepage);
|
|
router.get('*', frontend.single);
|
|
|
|
return router;
|
|
};
|
|
|
|
module.exports = frontendRoutes; |