godprotocol 2.3.28 → 2.3.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Godprotocol.js +13 -0
- package/package.json +1 -1
- package/server/Routable/Services.js +1 -1
package/Godprotocol.js
CHANGED
|
@@ -81,6 +81,19 @@ class GodProtocol {
|
|
|
81
81
|
await this.route_table.load_services(services);
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
+
_loaded_routers = [];
|
|
85
|
+
|
|
86
|
+
load_locals = async (services, opts = {}) => {
|
|
87
|
+
let { services_config } = opts;
|
|
88
|
+
|
|
89
|
+
for (let service of services) {
|
|
90
|
+
if (this._loaded_routers.includes(service.router)) continue;
|
|
91
|
+
|
|
92
|
+
this._loaded_routers.push(service.router);
|
|
93
|
+
await service.router(this, { services_config });
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
84
97
|
add_router = async (version, routes, opts = {}) => {
|
|
85
98
|
if (opts.alias) {
|
|
86
99
|
for (let o of opts.alias) {
|
package/package.json
CHANGED
|
@@ -82,7 +82,7 @@ class Services {
|
|
|
82
82
|
"Content-Type": "application/json",
|
|
83
83
|
Accept: "application/json",
|
|
84
84
|
"x-api-version":
|
|
85
|
-
servic.local && !header?.api_version
|
|
85
|
+
servic.local && !header?.api_version?.startsWith(`${servic.local}:`)
|
|
86
86
|
? `${servic.local}:${header?.api_version || servic.api_version}`
|
|
87
87
|
: header?.api_version || servic.api_version || "v1",
|
|
88
88
|
};
|