Added alias for non-versioned API endpoints

refs https://github.com/TryGhost/Toolbox/issues/169

- Before next major version release we need to prepare for removal of API versioning.
- This change allows unversioned API requests to work under following endpoints:
- /ghost/api/admin
- /ghost/api/content
- This change should allow further preparation of the API clients (SDKs, Integrations, etc.) to non-versioned APIs in Ghost instances in ^5.0.0
- Changed default e2e test targets to non-versioned API. It's a trial, to have working examples. In the future all tests should switch to use only non-versioned endpoints.
This commit is contained in:
Naz 2022-03-03 12:20:03 +07:00 committed by naz
parent cd1183c9d8
commit da0dee548c
3 changed files with 5 additions and 2 deletions

View File

@ -25,6 +25,9 @@ module.exports = function setupApiApp() {
apiApp.lazyUse(urlUtils.getVersionPath({version: 'canary', type: 'content'}), require('./canary/content/app'));
apiApp.lazyUse(urlUtils.getVersionPath({version: 'canary', type: 'admin'}), require('./canary/admin/app'));
apiApp.lazyUse('/content/', require('./canary/content/app'));
apiApp.lazyUse('/admin/', require('./canary/admin/app'));
// Error handling for requests to non-existent API versions
apiApp.use(errorHandler.resourceNotFound);
apiApp.use(errorHandler.handleJSONResponse(sentry));

View File

@ -7,7 +7,7 @@ const testUtils = require('../../utils');
// the commit introducing this comment.
const schema = require('../../../core/server/data/schema').tables;
const API_URL = '/ghost/api/canary/admin/';
const API_URL = '/ghost/api/admin/';
const expectedProperties = {
// API top level

View File

@ -2,7 +2,7 @@ const url = require('url');
const _ = require('lodash');
const testUtils = require('../../utils');
const API_URL = '/ghost/api/canary/content/';
const API_URL = '/ghost/api/content/';
const expectedProperties = {
// API top level