mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05: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
4 changed files with 4 additions and 4 deletions
|
@ -14,7 +14,7 @@ const helpers = require('../helpers');
|
||||||
module.exports = function previewController(req, res, next) {
|
module.exports = function previewController(req, res, next) {
|
||||||
debug('previewController');
|
debug('previewController');
|
||||||
|
|
||||||
const api = require('../../../../server/api')[res.locals.apiVersion];
|
const api = require('../../proxy').api[res.locals.apiVersion];
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
uuid: req.params.uuid,
|
uuid: req.params.uuid,
|
||||||
|
|
|
@ -4,7 +4,7 @@ const debug = require('@tryghost/debug')('services:routing:controllers:static');
|
||||||
const helpers = require('../helpers');
|
const helpers = require('../helpers');
|
||||||
|
|
||||||
function processQuery(query, locals) {
|
function processQuery(query, locals) {
|
||||||
const api = require('../../../../server/api')[locals.apiVersion];
|
const api = require('../../proxy').api[locals.apiVersion];
|
||||||
query = _.cloneDeep(query);
|
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
|
// 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) {
|
function entryLookup(postUrl, routerOptions, locals) {
|
||||||
debug(postUrl);
|
debug(postUrl);
|
||||||
|
|
||||||
const api = require('../../../../server/api')[locals.apiVersion];
|
const api = require('../../proxy').api[locals.apiVersion];
|
||||||
const targetPath = url.parse(postUrl).path;
|
const targetPath = url.parse(postUrl).path;
|
||||||
const permalinks = routerOptions.permalinks;
|
const permalinks = routerOptions.permalinks;
|
||||||
let isEditURL = false;
|
let isEditURL = false;
|
||||||
|
|
|
@ -45,7 +45,7 @@ defaultPostQuery.options = defaultQueryOptions.options;
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
function processQuery(query, slugParam, locals) {
|
function processQuery(query, slugParam, locals) {
|
||||||
const api = require('../../../../server/api')[locals.apiVersion];
|
const api = require('../../proxy').api[locals.apiVersion];
|
||||||
|
|
||||||
query = _.cloneDeep(query);
|
query = _.cloneDeep(query);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue