mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 14:03:48 +03:00
Decreased coupling of frontend routing to server api
refs https://github.com/TryGhost/Team/issues/527 refs https://github.com/TryGhost/Ghost/issues/10790 - Frontent has to have as few as possible coupling points with the Ghost Server API. By design that point has been a "proxy.api" property that will become more and more constraint in the future based to limit the surface of frontend interaction with servers's API - Removing `.../server/api` requires in favor of using a proxy decreases direct coupling
This commit is contained in:
parent
566615f014
commit
d1b569075f
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user