@rpcbase/server 0.346.0 → 0.347.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/express/index.js +12 -6
- package/package.json +1 -1
package/express/index.js
CHANGED
|
@@ -30,7 +30,7 @@ const BODY_MAX_SIZE_MB = 80
|
|
|
30
30
|
|
|
31
31
|
log("server is production:", JSON.stringify(is_production))
|
|
32
32
|
|
|
33
|
-
module.exports =
|
|
33
|
+
module.exports = () => {
|
|
34
34
|
|
|
35
35
|
const app = express()
|
|
36
36
|
|
|
@@ -77,16 +77,22 @@ module.exports = async() => {
|
|
|
77
77
|
|
|
78
78
|
custom_cors(app)
|
|
79
79
|
|
|
80
|
-
await sessions(app)
|
|
81
|
-
|
|
82
80
|
const pong_res = {app: `app_name:${JSON.stringify(process.env.RB_APP_NAME)}`, message: "pong"}
|
|
83
81
|
app.get("/__ping", (req, res) => res.json(pong_res))
|
|
84
82
|
app.post("/__ping", (req, res) => res.json(pong_res))
|
|
85
83
|
|
|
86
|
-
auth(app)
|
|
87
|
-
api(app)
|
|
88
84
|
|
|
89
|
-
|
|
85
|
+
const finalize = async() => {
|
|
86
|
+
// sessions middleware is async because it needs to connect to redis first
|
|
87
|
+
await sessions(app)
|
|
88
|
+
|
|
89
|
+
auth(app)
|
|
90
|
+
api(app)
|
|
91
|
+
|
|
92
|
+
dev_save_coverage(app)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
finalize()
|
|
90
96
|
|
|
91
97
|
return app
|
|
92
98
|
}
|