@midwayjs/express 3.2.1 → 3.3.1
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/dist/framework.js +8 -0
- package/package.json +5 -5
package/dist/framework.js
CHANGED
|
@@ -54,6 +54,14 @@ let MidwayExpressFramework = class MidwayExpressFramework extends core_1.BaseFra
|
|
|
54
54
|
debug('[express]: use user router middleware');
|
|
55
55
|
// load controller,must apply router filter here
|
|
56
56
|
const routerMiddlewares = await this.loadMidwayController();
|
|
57
|
+
if (this.mockService.getContextMocksSize() > 0) {
|
|
58
|
+
const mockMiddleware = (req, res, next) => {
|
|
59
|
+
this.mockService.applyContextMocks(this.app, req);
|
|
60
|
+
next();
|
|
61
|
+
};
|
|
62
|
+
this.app.use(mockMiddleware);
|
|
63
|
+
debug('[express]: use and apply mock framework');
|
|
64
|
+
}
|
|
57
65
|
// use global middleware
|
|
58
66
|
const globalMiddleware = await this.applyMiddleware();
|
|
59
67
|
debug('[express]: use and apply all framework and global middleware');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/express",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "Midway Web Framework for Express",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@midwayjs/decorator": "^3.1.6",
|
|
28
28
|
"@midwayjs/logger": "^2.15.0",
|
|
29
|
-
"@midwayjs/mock": "^3.
|
|
29
|
+
"@midwayjs/mock": "^3.3.1",
|
|
30
30
|
"@types/body-parser": "1.19.2",
|
|
31
31
|
"@types/express": "4.17.13",
|
|
32
32
|
"fs-extra": "10.0.1"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@midwayjs/core": "^3.
|
|
36
|
-
"@midwayjs/express-session": "^3.
|
|
35
|
+
"@midwayjs/core": "^3.3.1",
|
|
36
|
+
"@midwayjs/express-session": "^3.3.1",
|
|
37
37
|
"body-parser": "1.19.2",
|
|
38
38
|
"cookie-parser": "^1.4.6",
|
|
39
39
|
"express": "4.17.3"
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=12"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "f603b622b205ec126de628eeab59f90045a75dd2"
|
|
50
50
|
}
|