@midwayjs/express 2.13.1 → 2.14.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/CHANGELOG.md CHANGED
@@ -3,6 +3,41 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.14.0](https://github.com/midwayjs/midway/compare/v2.13.5...v2.14.0) (2021-12-06)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * express routing middleware takes effect at the controller level ([#1364](https://github.com/midwayjs/midway/issues/1364)) ([5d5f299](https://github.com/midwayjs/midway/commit/5d5f2992be116ca71b21f01fd782e3a2ac072496))
12
+
13
+
14
+
15
+
16
+
17
+ ## [2.13.4](https://github.com/midwayjs/midway/compare/v2.13.3...v2.13.4) (2021-10-21)
18
+
19
+ **Note:** Version bump only for package @midwayjs/express
20
+
21
+
22
+
23
+
24
+
25
+ ## [2.13.3](https://github.com/midwayjs/midway/compare/v2.13.2...v2.13.3) (2021-09-28)
26
+
27
+ **Note:** Version bump only for package @midwayjs/express
28
+
29
+
30
+
31
+
32
+
33
+ ## [2.13.2](https://github.com/midwayjs/midway/compare/v2.13.1...v2.13.2) (2021-09-09)
34
+
35
+ **Note:** Version bump only for package @midwayjs/express
36
+
37
+
38
+
39
+
40
+
6
41
  ## [2.13.1](https://github.com/midwayjs/midway/compare/v2.13.0...v2.13.1) (2021-09-08)
7
42
 
8
43
  **Note:** Version bump only for package @midwayjs/express
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  this is a sub package for midway.
7
7
 
8
- Document: [https://midwayjs.org/midway](https://midwayjs.org/midway)
8
+ Document: [https://midwayjs.org](https://midwayjs.org)
9
9
 
10
10
  ## License
11
11
 
@@ -15,7 +15,6 @@ export declare class MidwayExpressFramework extends BaseFramework<IMidwayExpress
15
15
  }>;
16
16
  private server;
17
17
  applicationInitialize(options: Partial<IMidwayBootstrapOptions>): Promise<void>;
18
- protected afterContainerReady(options: Partial<IMidwayBootstrapOptions>): Promise<void>;
19
18
  run(): Promise<void>;
20
19
  getFrameworkType(): MidwayFrameworkType;
21
20
  /**
package/dist/framework.js CHANGED
@@ -52,10 +52,8 @@ class MidwayExpressFramework extends core_1.BaseFramework {
52
52
  // register httpServer to applicationContext
53
53
  this.applicationContext.registerObject(core_1.HTTP_SERVER_KEY, this.server);
54
54
  }
55
- async afterContainerReady(options) {
56
- await this.loadMidwayController();
57
- }
58
55
  async run() {
56
+ await this.loadMidwayController();
59
57
  if (this.configurationOptions.port) {
60
58
  new Promise(resolve => {
61
59
  const args = [this.configurationOptions.port];
@@ -140,13 +138,14 @@ class MidwayExpressFramework extends core_1.BaseFramework {
140
138
  // add route
141
139
  const routes = routerTable.get(routerInfo.prefix);
142
140
  for (const routeInfo of routes) {
141
+ const routeMiddlewareList = [];
143
142
  // router middleware
144
143
  await this.handlerWebMiddleware(routeInfo.middleware, (middlewareImpl) => {
145
- newRouter.use(middlewareImpl);
144
+ routeMiddlewareList.push(middlewareImpl);
146
145
  });
147
146
  this.logger.debug(`Load Router "${routeInfo.requestMethod.toUpperCase()} ${routeInfo.url}"`);
148
147
  // apply controller from request context
149
- newRouter[routeInfo.requestMethod].call(newRouter, routeInfo.url, this.generateController(routeInfo.handlerName, routeInfo.requestMetadata, routeInfo.responseMetadata));
148
+ newRouter[routeInfo.requestMethod].call(newRouter, routeInfo.url, ...routeMiddlewareList, this.generateController(routeInfo.handlerName, routeInfo.requestMetadata, routeInfo.responseMetadata));
150
149
  }
151
150
  this.app.use(routerInfo.prefix, newRouter);
152
151
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/express",
3
- "version": "2.13.1",
3
+ "version": "2.14.0",
4
4
  "description": "Midway Web Framework for Express",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index.d.ts",
@@ -23,13 +23,13 @@
23
23
  ],
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@midwayjs/decorator": "^2.13.0",
27
- "@midwayjs/mock": "^2.13.1",
26
+ "@midwayjs/decorator": "^2.14.0",
27
+ "@midwayjs/mock": "^2.14.0",
28
28
  "@types/express": "^4.17.8",
29
29
  "fs-extra": "^8.0.1"
30
30
  },
31
31
  "dependencies": {
32
- "@midwayjs/core": "^2.13.1",
32
+ "@midwayjs/core": "^2.14.0",
33
33
  "@midwayjs/logger": "^2.13.0",
34
34
  "express": "^4.17.1"
35
35
  },
@@ -41,5 +41,5 @@
41
41
  "engines": {
42
42
  "node": ">=10.10.0"
43
43
  },
44
- "gitHead": "d50576713e723aef47f1f7464eeecae82e605874"
44
+ "gitHead": "5fd716b0e731162d8e9f0931790fde7402fb83de"
45
45
  }