mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
refs #9192 - Instead of `setupRoutes` function in apps that gets passed a router, there is now a registerRouter function as part of the proxy - Moved towards a route service, which will know about all routes - Using classes to abstract away shared behaviour Notes: - changing the app proxy didn't result in a test failure! - structure of route service is totally new and may change a lot yet
21 lines
661 B
JavaScript
21 lines
661 B
JavaScript
var router = require('./lib/router'),
|
|
registerHelpers = require('./lib/helpers'),
|
|
|
|
// Dirty requires
|
|
config = require('../../config'),
|
|
labs = require('../../utils/labs');
|
|
|
|
module.exports = {
|
|
activate: function activate(ghost) {
|
|
// TODO, how to do all this only if the Subscribers flag is set?!
|
|
registerHelpers(ghost);
|
|
|
|
ghost.routeService.registerRouter('/' + config.get('routeKeywords').subscribe + '/', function labsEnabledRouter(req, res, next) {
|
|
if (labs.isSet('subscribers') === true) {
|
|
return router.apply(this, arguments);
|
|
}
|
|
|
|
next();
|
|
});
|
|
}
|
|
};
|