Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3755399
D2189.id5508.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D2189.id5508.diff
View Options
diff --git a/app.js b/app.js
--- a/app.js
+++ b/app.js
@@ -20,4 +20,5 @@
module.exports = app;
-app.use('/', require('./routes'));
+const api_entry_point = process.env.API_ENTRY_POINT || '/datasources';
+app.use(api_entry_point, require('./routes'));
diff --git a/routes.js b/routes.js
--- a/routes.js
+++ b/routes.js
@@ -17,7 +17,7 @@
const datasources = [
{
- url: "dev/openfire/changelog",
+ url: "/dev/openfire/changelog",
controller: "/dev/openfire/changelog.js",
description: "Openfire changelog",
},
@@ -41,7 +41,7 @@
(protocol === "https" && port !== 443);
}
-function getUrl(req) {
+function getServerUrl(req) {
const port = app.get("port");
let url = req.protocol + "://" + req.hostname;
@@ -49,19 +49,18 @@
url += ":" + port;
}
- url += req.url;
-
return url;
}
-router.get('/', function(req, res) {
- let url = getUrl(req);
+router.get("/", function(req, res) {
+ const api_entry_point = process.env.API_ENTRY_POINT || '/datasources';
+ const url = getServerUrl(req) + api_entry_point;
res.send(JSON.stringify(formatDatasources(url)));
});
datasources.forEach(function (datasource) {
- router.get('/' + datasource.url, function (req, res) {
+ router.get(datasource.url, function (req, res) {
require("./controllers/" + datasource.controller)
.get(req, res);
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 19, 15:25 (21 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2251659
Default Alt Text
D2189.id5508.diff (1 KB)
Attached To
Mode
D2189: Fix mounting point for nginx proxy
Attached
Detach File
Event Timeline
Log In to Comment