Ghost/core/server/apps/amp/index.js
2017-12-14 03:01:23 +01:00

23 lines
647 B
JavaScript

var router = require('./lib/router'),
registerHelpers = require('./lib/helpers'),
// Dirty requires
config = require('../../config'),
settingsCache = require('../../services/settings/cache');
module.exports = {
activate: function activate(ghost) {
var ampRoute = '*/' + config.get('routeKeywords').amp + '/';
ghost.routeService.registerRouter(ampRoute, function settingsEnabledRouter(req, res, next) {
if (settingsCache.get('amp') === true) {
return router.apply(this, arguments);
}
next();
});
registerHelpers(ghost);
}
};