mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 00:16:00 +00:00
#228 running dbgate on subpath
This commit is contained in:
10
packages/api/src/utility/getExpressPath.js
Normal file
10
packages/api/src/utility/getExpressPath.js
Normal file
@@ -0,0 +1,10 @@
|
||||
function getExpressPath(path) {
|
||||
path = path.replace(/\/*$/, '').replace(/^\/*/, '');
|
||||
const root = (process.env.WEB_ROOT || '').replace(/^\/*/, '').replace(/\/*$/, '');
|
||||
if (root) {
|
||||
return `/${root}/${path}`;
|
||||
}
|
||||
return `/${path}`;
|
||||
}
|
||||
|
||||
module.exports = getExpressPath;
|
||||
Reference in New Issue
Block a user