Skip to content

Commit 92d7fa8

Browse files
robin7331drew-gross
authored andcommitted
using mount path when mounted as express module (#486)
1 parent ef81023 commit 92d7fa8

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Parse-Dashboard/app.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ packageJson('parse-dashboard', 'latest').then(latestPackage => {
1717
});
1818

1919
function getMount(req) {
20-
let url = req.url;
21-
let originalUrl = req.originalUrl;
22-
var mountPathLength = req.originalUrl.length - req.url.length;
23-
var mountPath = req.originalUrl.slice(0, mountPathLength);
24-
if (!mountPath.endsWith('/')) {
25-
mountPath += '/';
20+
const url = req.url;
21+
const originalUrl = req.originalUrl;
22+
const mountPath = process.env.MOUNT_PATH || '';
23+
const mountPathLength = req.originalUrl.length - req.url.length;
24+
let mountPathLocal = req.originalUrl.slice(0, mountPathLength);
25+
if (!mountPathLocal.endsWith('/')) {
26+
mountPathLocal += '/';
2627
}
27-
return mountPath;
28+
return mountPath + mountPathLocal;
2829
}
2930

3031
function checkIfIconsExistForApps(apps, iconsFolder) {

0 commit comments

Comments
 (0)