@live-change/server 0.9.127 → 0.9.129
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/index.js +2 -1
- package/lib/setupApiEndpoints.js +19 -1
- package/package.json +7 -7
package/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import renderTemplate from './lib/renderTemplate.js'
|
|
|
8
8
|
import setupApiServer from './lib/setupApiServer.js'
|
|
9
9
|
import setupApiSockJs from './lib/setupApiSockJs.js'
|
|
10
10
|
import setupApiWs from './lib/setupApiWs.js'
|
|
11
|
-
import setupApiEndpoints from './lib/setupApiEndpoints.js'
|
|
11
|
+
import { setupApiEndpoints, setupEndpointsProxyPaths } from './lib/setupApiEndpoints.js'
|
|
12
12
|
import setupDbServer from './lib/setupDbServer.js'
|
|
13
13
|
import setupDbClient from './lib/setupDbClient.js'
|
|
14
14
|
import setupApp from './lib/setupApp.js'
|
|
@@ -25,6 +25,7 @@ export {
|
|
|
25
25
|
setupApiSockJs,
|
|
26
26
|
setupApiWs,
|
|
27
27
|
setupApiEndpoints,
|
|
28
|
+
setupEndpointsProxyPaths,
|
|
28
29
|
setupDbServer,
|
|
29
30
|
setupDbClient,
|
|
30
31
|
setupApp
|
package/lib/setupApiEndpoints.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
async function setupApiEndpoints(expressApp, apiServer) {
|
|
1
|
+
export async function setupApiEndpoints(expressApp, apiServer) {
|
|
2
2
|
for(const serviceDefinition of apiServer.services.serviceDefinitions) {
|
|
3
3
|
const { name, endpoints } = serviceDefinition
|
|
4
4
|
for(const endpoint of endpoints) {
|
|
@@ -12,4 +12,22 @@ async function setupApiEndpoints(expressApp, apiServer) {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
export async function setupEndpointsProxyPaths(expressApp, proxy, services) {
|
|
16
|
+
for(const service of services.services) {
|
|
17
|
+
const { module } = service
|
|
18
|
+
const { name, endpoints } = module
|
|
19
|
+
//console.log("SERVICE", name, "HAS ENDPOINTS", endpoints)
|
|
20
|
+
if(!endpoints) continue
|
|
21
|
+
for(const endpoint of endpoints) {
|
|
22
|
+
let paths = endpoint.path ?? (endpoint.name ? `/api/${name}/${endpoint.name}` : `/${name}`)
|
|
23
|
+
if(!Array.isArray(paths)) paths = [paths]
|
|
24
|
+
paths = paths.filter(path => !path.startsWith('/api/')) // api will be proxied anyway
|
|
25
|
+
for(const path of paths) {
|
|
26
|
+
console.log("PROXY", path)
|
|
27
|
+
expressApp.use(path, proxy)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
15
33
|
export default setupApiEndpoints
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/server",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.129",
|
|
4
4
|
"description": "Live Change Framework - server",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"type": "module",
|
|
23
23
|
"homepage": "https://github.com/live-change/live-change-stack",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@live-change/dao": "^0.9.
|
|
26
|
-
"@live-change/dao-sockjs": "^0.9.
|
|
27
|
-
"@live-change/db-server": "^0.9.
|
|
28
|
-
"@live-change/framework": "^0.9.
|
|
25
|
+
"@live-change/dao": "^0.9.129",
|
|
26
|
+
"@live-change/dao-sockjs": "^0.9.129",
|
|
27
|
+
"@live-change/db-server": "^0.9.129",
|
|
28
|
+
"@live-change/framework": "^0.9.129",
|
|
29
29
|
"@live-change/sockjs": "0.4.1",
|
|
30
|
-
"@live-change/uid": "^0.9.
|
|
30
|
+
"@live-change/uid": "^0.9.129",
|
|
31
31
|
"dotenv": "^17.2.1",
|
|
32
32
|
"express": "^4.18.2",
|
|
33
33
|
"express-static-gzip": "2.1.7",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"websocket": "^1.0.34",
|
|
40
40
|
"yargs": "^17.7.2"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "243c2cc85e556cd6f4de4cf65ae4bf8cb8d584a6"
|
|
43
43
|
}
|