chimney
This commit is contained in:
parent
98188ed093
commit
2299af2b01
|
@ -32,7 +32,6 @@ module.exports.create = function (xconfx, apiFactories, apiDeps) {
|
||||||
var appApiGrantsPath = path.join(myConf.appApiGrantsPath, clientUrih);
|
var appApiGrantsPath = path.join(myConf.appApiGrantsPath, clientUrih);
|
||||||
|
|
||||||
return fs.readFileAsync(appApiGrantsPath, 'utf8').then(function (text) {
|
return fs.readFileAsync(appApiGrantsPath, 'utf8').then(function (text) {
|
||||||
console.log('sanity', text);
|
|
||||||
return text.trim().split(/\n/);
|
return text.trim().split(/\n/);
|
||||||
}, function (err) {
|
}, function (err) {
|
||||||
if ('ENOENT' !== err.code) {
|
if ('ENOENT' !== err.code) {
|
||||||
|
@ -42,7 +41,6 @@ module.exports.create = function (xconfx, apiFactories, apiDeps) {
|
||||||
}).then(function (apis) {
|
}).then(function (apis) {
|
||||||
if (apis.some(function (api) {
|
if (apis.some(function (api) {
|
||||||
if (api === pkgId) {
|
if (api === pkgId) {
|
||||||
console.log(api, pkgId, api === pkgId);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
})) {
|
})) {
|
||||||
|
@ -324,7 +322,6 @@ module.exports.create = function (xconfx, apiFactories, apiDeps) {
|
||||||
req._walnutOriginalUrl = req.url;
|
req._walnutOriginalUrl = req.url;
|
||||||
// "/path/api/com.example/hello".replace(/.*\/api\//, '').replace(/([^\/]*\/+)/, '/') => '/hello'
|
// "/path/api/com.example/hello".replace(/.*\/api\//, '').replace(/([^\/]*\/+)/, '/') => '/hello'
|
||||||
req.url = req.url.replace(/\/api\//, '').replace(/.*\/api\//, '').replace(/([^\/]*\/+)/, '/');
|
req.url = req.url.replace(/\/api\//, '').replace(/.*\/api\//, '').replace(/([^\/]*\/+)/, '/');
|
||||||
console.log('[prehandler] req.url', req.url);
|
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -338,7 +335,6 @@ module.exports.create = function (xconfx, apiFactories, apiDeps) {
|
||||||
|
|
||||||
myApp.use('/', function postHandler(req, res, next) {
|
myApp.use('/', function postHandler(req, res, next) {
|
||||||
req.url = req._walnutOriginalUrl;
|
req.url = req._walnutOriginalUrl;
|
||||||
console.log('[posthandler] req.url', req.url);
|
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -388,7 +384,6 @@ module.exports.create = function (xconfx, apiFactories, apiDeps) {
|
||||||
|
|
||||||
return function (req, res, next) {
|
return function (req, res, next) {
|
||||||
cors(req, res, function () {
|
cors(req, res, function () {
|
||||||
console.log('[sanity check]', req.url);
|
|
||||||
// Canonical client names
|
// Canonical client names
|
||||||
// example.com should use api.example.com/api for all requests
|
// example.com should use api.example.com/api for all requests
|
||||||
// sub.example.com/api should resolve to sub.example.com
|
// sub.example.com/api should resolve to sub.example.com
|
||||||
|
|
Loading…
Reference in New Issue