diff --git a/core/frontend/services/routing/controllers/preview.js b/core/frontend/services/routing/controllers/preview.js index 4b6bd664b3..decd5e1a64 100644 --- a/core/frontend/services/routing/controllers/preview.js +++ b/core/frontend/services/routing/controllers/preview.js @@ -14,7 +14,7 @@ const helpers = require('../helpers'); module.exports = function previewController(req, res, next) { debug('previewController'); - const api = require('../../../../server/api')[res.locals.apiVersion]; + const api = require('../../proxy').api[res.locals.apiVersion]; const params = { uuid: req.params.uuid, diff --git a/core/frontend/services/routing/controllers/static.js b/core/frontend/services/routing/controllers/static.js index c012e597c7..92246cd471 100644 --- a/core/frontend/services/routing/controllers/static.js +++ b/core/frontend/services/routing/controllers/static.js @@ -4,7 +4,7 @@ const debug = require('@tryghost/debug')('services:routing:controllers:static'); const helpers = require('../helpers'); function processQuery(query, locals) { - const api = require('../../../../server/api')[locals.apiVersion]; + const api = require('../../proxy').api[locals.apiVersion]; query = _.cloneDeep(query); // CASE: If you define a single data key for a static route (e.g. data: page.team), this static route will represent diff --git a/core/frontend/services/routing/helpers/entry-lookup.js b/core/frontend/services/routing/helpers/entry-lookup.js index b7c3937cc8..4269fbb895 100644 --- a/core/frontend/services/routing/helpers/entry-lookup.js +++ b/core/frontend/services/routing/helpers/entry-lookup.js @@ -14,7 +14,7 @@ const routeMatch = require('path-match')(); function entryLookup(postUrl, routerOptions, locals) { debug(postUrl); - const api = require('../../../../server/api')[locals.apiVersion]; + const api = require('../../proxy').api[locals.apiVersion]; const targetPath = url.parse(postUrl).path; const permalinks = routerOptions.permalinks; let isEditURL = false; diff --git a/core/frontend/services/routing/helpers/fetch-data.js b/core/frontend/services/routing/helpers/fetch-data.js index f642542f83..ddbe2c6981 100644 --- a/core/frontend/services/routing/helpers/fetch-data.js +++ b/core/frontend/services/routing/helpers/fetch-data.js @@ -45,7 +45,7 @@ defaultPostQuery.options = defaultQueryOptions.options; * @returns {Promise} */ function processQuery(query, slugParam, locals) { - const api = require('../../../../server/api')[locals.apiVersion]; + const api = require('../../proxy').api[locals.apiVersion]; query = _.cloneDeep(query);