forest-express
Version:
Official package for all Forest Express Lianas
24 lines (23 loc) • 832 B
JavaScript
;
var path = require('../services/path');
var auth = require('../services/auth');
function initScopeRoutes(app, _ref) {
var configStore = _ref.configStore,
scopeManager = _ref.scopeManager,
logger = _ref.logger;
app.post(path.generate('scope-cache-invalidation', configStore.lianaOptions), auth.ensureAuthenticated, function (request, response) {
try {
var renderingId = request.body.renderingId;
if (!renderingId) {
logger.error('missing renderingId');
return response.status(400).send();
}
scopeManager.invalidateScopeCache(renderingId);
return response.status(200).send();
} catch (error) {
logger.error('Error during scope cache invalidation: ', error);
return response.status(500).send();
}
});
}
module.exports = initScopeRoutes;