@rpcbase/server 0.343.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.
@@ -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.343.0",
3
+ "version": "0.344.0",
4
4
  "license": "SSPL-1.0",
5
5
  "main": "./index.js",
6
6
  "scripts": {