@rpcbase/server 0.342.0 → 0.344.0

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/boot/shared.js CHANGED
@@ -3,6 +3,8 @@ if (typeof __RB_IS_WEBPACK__ === "undefined") {
3
3
  throw new Error("cannot run outside of webpack bundling")
4
4
  }
5
5
 
6
+ require("source-map-support").install()
7
+
6
8
  require("./setup_env")
7
9
 
8
10
  require("../extend-expect")
@@ -31,9 +31,12 @@ const setup_handlers = (app) => {
31
31
 
32
32
  // app.handler
33
33
  app.handler = (path, fn) => {
34
+
35
+ const resolved_fn = typeof fn === "function" ? fn : fn.default
36
+
34
37
  app.post(path, async (req, res, next) => {
35
38
  try {
36
- const result = await fn(req.body, {req, res})
39
+ const result = await resolved_fn(req.body, {req, res})
37
40
  res.json(result)
38
41
  } catch (err) {
39
42
  next(err)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/server",
3
- "version": "0.342.0",
3
+ "version": "0.344.0",
4
4
  "license": "SSPL-1.0",
5
5
  "main": "./index.js",
6
6
  "scripts": {
@@ -84,6 +84,7 @@
84
84
  "request-ip": "3.3.0",
85
85
  "sift": "17.0.1",
86
86
  "socket.io": "4.7.4",
87
+ "source-map-support": "0.5.21",
87
88
  "validator": "13.11.0"
88
89
  }
89
90
  }
@@ -58,6 +58,8 @@ const serve_file = (req, res, full_path) => {
58
58
  const client_router = (app) => {
59
59
  const client_routes = get_client_routes()
60
60
 
61
+
62
+
61
63
  const index_file_path = path.join(client_build_dir, "./index.html")
62
64
  if (fs.existsSync(index_file_path)) {
63
65
  const index_file_buffer = fs.readFileSync(index_file_path)
@@ -1,2 +0,0 @@
1
- client router serves the client from the server
2
- in production the client could be served from the CDN, but the server is also suitable