0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Increased route specificity for API error handling (#11795)

no-issue

This ensures that errors that are not part of the members frontend API will be handled by the theme and not with JSON
This commit is contained in:
Fabien O'Carroll 2020-05-07 22:38:58 +02:00 committed by GitHub
parent bcfde580c7
commit 27a5887696
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,8 +39,12 @@ module.exports = function setupMembersApp() {
membersApp.put('/api/subscriptions/:id', (req, res, next) => membersService.api.middleware.updateSubscription(req, res, next));
// API error handling
membersApp.use(shared.middlewares.errorHandler.resourceNotFound);
membersApp.use(shared.middlewares.errorHandler.handleJSONResponseV2);
membersApp.use('/api', shared.middlewares.errorHandler.resourceNotFound);
membersApp.use('/api', shared.middlewares.errorHandler.handleJSONResponseV2);
// Webhook error handling
membersApp.use('/webhooks', shared.middlewares.errorHandler.resourceNotFound);
membersApp.use('/webhooks', shared.middlewares.errorHandler.handleJSONResponseV2);
debug('Members App setup end');