diff --git a/lib/apis.js b/lib/apis.js index 057bf2c..2443ef2 100644 --- a/lib/apis.js +++ b/lib/apis.js @@ -395,6 +395,7 @@ module.exports.create = function (xconfx, apiFactories, apiDeps) { // example.com/subpath/api should resolve to example.com#subapp // sub.example.com/subpath/api should resolve to sub.example.com#subapp var clientUrih = req.hostname.replace(/^api\./, '') + req.url.replace(/\/api\/.*/, '/').replace(/\/+/g, '#').replace(/#$/, ''); + var clientApiUri = req.hostname + req.url.replace(/\/api\/.*/, '/').replace(/\/$/, ''); // Canonical package names // '/api/com.daplie.hello/hello' should resolve to 'com.daplie.hello' // '/subapp/api/com.daplie.hello/hello' should also 'com.daplie.hello' @@ -410,6 +411,12 @@ module.exports.create = function (xconfx, apiFactories, apiDeps) { , writable: false , value: clientUrih }); + Object.defineProperty(req, 'clientApiUri', { + enumerable: true + , configurable: false + , writable: false + , value: clientApiUri + }); Object.defineProperty(req, 'apiId', { enumerable: true , configurable: false