Skip to content

Commit

Permalink
Updated web/ to use API config (#9936)
Browse files Browse the repository at this point in the history
refs #9866

- exports `getApiPath` method from service/url/utils
- uses `getApiPath` in web/parent-app to configure API paths for supported versions
  • Loading branch information
rishabhgrg authored and kirrg001 committed Oct 2, 2018
1 parent cb0c5dc commit c795920
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions core/server/services/url/utils.js
Expand Up @@ -458,6 +458,7 @@ module.exports.redirectToAdmin = redirectToAdmin;
module.exports.redirect301 = redirect301;
module.exports.createUrl = createUrl;
module.exports.deduplicateDoubleSlashes = deduplicateDoubleSlashes;
module.exports.getApiPath = getApiPath;

/**
* If you request **any** image in Ghost, it get's served via
Expand Down
7 changes: 4 additions & 3 deletions core/server/web/parent-app.js
Expand Up @@ -4,6 +4,7 @@ const config = require('../config');
const compress = require('compression');
const netjet = require('netjet');
const shared = require('./shared');
const urlUtils = require('../services/url/utils');

module.exports = function setupParentApp(options = {}) {
debug('ParentApp setup start');
Expand Down Expand Up @@ -38,9 +39,9 @@ module.exports = function setupParentApp(options = {}) {
// API
// @TODO: finish refactoring the API app
// @TODO: decide what to do with these paths - config defaults? config overrides?
parentApp.use('/ghost/api/v0.1/', require('./api/v0.1/app')());
parentApp.use('/ghost/api/v2/content/', require('./api/v2/content/app')());
parentApp.use('/ghost/api/v2/admin/', require('./api/v2/admin/app')());
parentApp.use(urlUtils.getApiPath('deprecated'), require('./api/v0.1/app')());
parentApp.use(urlUtils.getApiPath('active'), require('./api/v2/content/app')());
parentApp.use(urlUtils.getApiPath('active', true), require('./api/v2/admin/app')());

// ADMIN
parentApp.use('/ghost', require('./admin')());
Expand Down

0 comments on commit c795920

Please sign in to comment.