@midwayjs/web 3.0.0-beta.12 → 3.0.0-beta.13

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,17 @@
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
+ # [3.0.0-beta.13](https://github.com/midwayjs/midway/compare/v3.0.0-beta.12...v3.0.0-beta.13) (2021-12-30)
7
+
8
+
9
+ ### Features
10
+
11
+ * 404 error ([#1465](https://github.com/midwayjs/midway/issues/1465)) ([e7e8a9d](https://github.com/midwayjs/midway/commit/e7e8a9dedfa7198ac05b161b41024c2871f93965))
12
+
13
+
14
+
15
+
16
+
6
17
  # [3.0.0-beta.12](https://github.com/midwayjs/midway/compare/v3.0.0-beta.11...v3.0.0-beta.12) (2021-12-28)
7
18
 
8
19
 
@@ -69,10 +69,17 @@ let MidwayWebFramework = class MidwayWebFramework extends core_1.BaseFramework {
69
69
  if (!this.isClusterMode) {
70
70
  await this.initSingleProcessEgg();
71
71
  }
72
+ // not found middleware
73
+ const notFound = async (ctx, next) => {
74
+ await next();
75
+ if (!ctx._matchedRoute) {
76
+ throw new core_1.httpError.NotFoundError();
77
+ }
78
+ };
72
79
  // insert error handler
73
80
  const midwayRootMiddleware = async (ctx, next) => {
74
81
  // this.app.createAnonymousContext(ctx);
75
- await (await this.applyMiddleware())(ctx, next);
82
+ await (await this.applyMiddleware(notFound))(ctx, next);
76
83
  };
77
84
  this.app.use(midwayRootMiddleware);
78
85
  this.generator = new EggControllerGenerator(this.app);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/web",
3
- "version": "3.0.0-beta.12",
3
+ "version": "3.0.0-beta.13",
4
4
  "description": "Midway Web Framework for Egg.js",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index.d.ts",
@@ -27,9 +27,9 @@
27
27
  ],
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@midwayjs/decorator": "^3.0.0-beta.12",
31
- "@midwayjs/logger": "^3.0.0-beta.12",
32
- "@midwayjs/mock": "^3.0.0-beta.12",
30
+ "@midwayjs/decorator": "^3.0.0-beta.13",
31
+ "@midwayjs/logger": "^3.0.0-beta.13",
32
+ "@midwayjs/mock": "^3.0.0-beta.13",
33
33
  "dayjs": "^1.10.7",
34
34
  "egg-logger": "^2.4.2",
35
35
  "egg-mock": "^3.26.0",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@eggjs/router": "^2.0.0",
47
- "@midwayjs/core": "^3.0.0-beta.12",
47
+ "@midwayjs/core": "^3.0.0-beta.13",
48
48
  "egg": "^2.28.0",
49
49
  "extend2": "^1.0.0",
50
50
  "find-up": "^5.0.0",
@@ -58,5 +58,5 @@
58
58
  "engines": {
59
59
  "node": ">=12"
60
60
  },
61
- "gitHead": "1c46e53eb934248007eeb7fe3920f5ac24e272c6"
61
+ "gitHead": "d3c47770fee9dce33a8d148882173fd7782864ad"
62
62
  }