Ghost/core/server/apps/amp/index.js
Hannah Wolfe 474e9234a6 Simplified AMP internal app
refs #9192

- The AMP app is nothing more than a custom controller - this will come clear soon
- Moved enabled/disabled logic into router
- Removed error-related code, as this wasn't used
- Changed logic for static pages to be based on req.body, not context
- Improved the tests to match
2017-11-08 08:25:25 +00:00

21 lines
604 B
JavaScript

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