@fastcar/koa 0.1.20 → 0.1.21
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/package.json +28 -19
- package/src/KoaApplication.ts +2 -2
- package/target/KoaApplication.js +2 -2
- package/test/logs/sys.log +23 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fastcar/koa",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"homepage": "https://github.com/williamDazhangyu/fast-car",
|
|
5
5
|
"description": "fastcar框架下对koa的包装",
|
|
6
6
|
"main": "target/index.js",
|
|
@@ -33,33 +33,33 @@
|
|
|
33
33
|
"@fastcar/core": "^0.3.10",
|
|
34
34
|
"@fastcar/server": "^0.0.3",
|
|
35
35
|
"@types/co-body": "^6.1.3",
|
|
36
|
-
"@types/koa": "^
|
|
36
|
+
"@types/koa": "^3.0.1",
|
|
37
37
|
"@types/koa__multer": "*",
|
|
38
|
-
"
|
|
38
|
+
"koa2-cors": "^2.0.6",
|
|
39
39
|
"reflect-metadata": "*"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@koa/bodyparser": "^
|
|
43
|
-
"@koa/router": "^
|
|
44
|
-
"koa": "^
|
|
42
|
+
"@koa/bodyparser": "^6.0.0",
|
|
43
|
+
"@koa/router": "^15.1.1",
|
|
44
|
+
"koa": "^3.1.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@fastcar/core": "*",
|
|
48
48
|
"@fastcar/server": "*",
|
|
49
|
-
"@koa/multer": "
|
|
50
|
-
"@types/koa-mount": "
|
|
51
|
-
"@types/koa-range": "
|
|
52
|
-
"@types/koa-static": "
|
|
53
|
-
"@types/koa2-cors": "
|
|
54
|
-
"http-proxy-middleware": "
|
|
55
|
-
"koa-body": "
|
|
56
|
-
"koa-mount": "
|
|
57
|
-
"koa-range": "
|
|
58
|
-
"koa-static": "
|
|
59
|
-
"koa2-connect": "
|
|
60
|
-
"koa2-cors": "
|
|
49
|
+
"@koa/multer": "*",
|
|
50
|
+
"@types/koa-mount": "*",
|
|
51
|
+
"@types/koa-range": "*",
|
|
52
|
+
"@types/koa-static": "*",
|
|
53
|
+
"@types/koa2-cors": "*",
|
|
54
|
+
"http-proxy-middleware": "*",
|
|
55
|
+
"koa-body": "*",
|
|
56
|
+
"koa-mount": "*",
|
|
57
|
+
"koa-range": "*",
|
|
58
|
+
"koa-static": "*",
|
|
59
|
+
"koa2-connect": "*",
|
|
60
|
+
"koa2-cors": "*",
|
|
61
61
|
"multer": "*",
|
|
62
|
-
"path-to-regexp": "
|
|
62
|
+
"path-to-regexp": "*"
|
|
63
63
|
},
|
|
64
64
|
"peerDependenciesMeta": {
|
|
65
65
|
"@types/koa-mount": {
|
|
@@ -106,6 +106,15 @@
|
|
|
106
106
|
},
|
|
107
107
|
"@koa/bodyparser": {
|
|
108
108
|
"optional": true
|
|
109
|
+
},
|
|
110
|
+
"http-proxy-middleware": {
|
|
111
|
+
"optional": true
|
|
112
|
+
},
|
|
113
|
+
"koa2-connect": {
|
|
114
|
+
"optional": true
|
|
115
|
+
},
|
|
116
|
+
"path-to-regexp": {
|
|
117
|
+
"optional": true
|
|
109
118
|
}
|
|
110
119
|
},
|
|
111
120
|
"repository": {
|
package/src/KoaApplication.ts
CHANGED
|
@@ -2,7 +2,7 @@ import "reflect-metadata";
|
|
|
2
2
|
import { ApplicationStart, ApplicationStop, Autowired, Log } from "@fastcar/core/annotation";
|
|
3
3
|
import { FastCarApplication, BootPriority, ComponentKind, Logger } from "@fastcar/core";
|
|
4
4
|
import * as Koa from "koa";
|
|
5
|
-
import
|
|
5
|
+
import KoaRouter from "@koa/router";
|
|
6
6
|
import { MethodType } from "./type/MethodType";
|
|
7
7
|
import { DesignMeta } from "./type/DesignMeta";
|
|
8
8
|
import { TypeUtil, ValidationUtil } from "@fastcar/core/utils";
|
|
@@ -53,7 +53,7 @@ export default class KoaApplication {
|
|
|
53
53
|
*
|
|
54
54
|
*/
|
|
55
55
|
protected loadRoute(): Koa.Middleware {
|
|
56
|
-
|
|
56
|
+
const router = new KoaRouter();
|
|
57
57
|
|
|
58
58
|
let instanceList = this.app.getComponentByType(ComponentKind.Controller);
|
|
59
59
|
|
package/target/KoaApplication.js
CHANGED
|
@@ -13,7 +13,7 @@ require("reflect-metadata");
|
|
|
13
13
|
const annotation_1 = require("@fastcar/core/annotation");
|
|
14
14
|
const core_1 = require("@fastcar/core");
|
|
15
15
|
const Koa = require("koa");
|
|
16
|
-
const
|
|
16
|
+
const router_1 = require("@koa/router");
|
|
17
17
|
const DesignMeta_1 = require("./type/DesignMeta");
|
|
18
18
|
const utils_1 = require("@fastcar/core/utils");
|
|
19
19
|
const server_1 = require("@fastcar/server");
|
|
@@ -52,7 +52,7 @@ let KoaApplication = class KoaApplication {
|
|
|
52
52
|
*
|
|
53
53
|
*/
|
|
54
54
|
loadRoute() {
|
|
55
|
-
|
|
55
|
+
const router = new router_1.default();
|
|
56
56
|
let instanceList = this.app.getComponentByType(core_1.ComponentKind.Controller);
|
|
57
57
|
//查找绑定的url
|
|
58
58
|
instanceList.forEach((instance) => {
|
package/test/logs/sys.log
CHANGED
|
@@ -183,3 +183,26 @@
|
|
|
183
183
|
{"timestamp":"2025-12-23 10:59:33.833","level":"INFO","label":"sys","message":"http server is running in 1234"}
|
|
184
184
|
{"timestamp":"2025-12-23 10:59:33.834","level":"INFO","label":"sys","message":"start server koaSimple is run"}
|
|
185
185
|
{"timestamp":"2025-12-23 10:59:33.835","level":"INFO","label":"sys","message":"version 1.0.0"}
|
|
186
|
+
{"timestamp":"2025-12-23 22:14:30.131","level":"INFO","label":"sys","message":"Start scanning component"}
|
|
187
|
+
{"timestamp":"2025-12-23 22:14:33.982","level":"INFO","label":"sys","message":"Complete component scan"}
|
|
188
|
+
{"timestamp":"2025-12-23 22:14:33.984","level":"INFO","label":"sys","message":"Call application initialization method"}
|
|
189
|
+
{"timestamp":"2025-12-23 22:14:34.06","level":"INFO","label":"sys","message":"http server is running in 1234"}
|
|
190
|
+
{"timestamp":"2025-12-23 22:14:34.07","level":"INFO","label":"sys","message":"start server koaSimple is run"}
|
|
191
|
+
{"timestamp":"2025-12-23 22:14:34.09","level":"INFO","label":"sys","message":"version 1.0.0"}
|
|
192
|
+
{"timestamp":"2025-12-23 22:29:19.999","level":"INFO","label":"sys","message":"Start scanning component"}
|
|
193
|
+
{"timestamp":"2025-12-23 22:29:20.679","level":"INFO","label":"sys","message":"Complete component scan"}
|
|
194
|
+
{"timestamp":"2025-12-23 22:29:20.681","level":"INFO","label":"sys","message":"Call application initialization method"}
|
|
195
|
+
{"timestamp":"2025-12-23 22:29:20.692","level":"INFO","label":"sys","message":"http server is running in 1234"}
|
|
196
|
+
{"timestamp":"2025-12-23 22:29:20.693","level":"INFO","label":"sys","message":"start server koaSimple is run"}
|
|
197
|
+
{"timestamp":"2025-12-23 22:29:20.694","level":"INFO","label":"sys","message":"version 1.0.0"}
|
|
198
|
+
{"timestamp":"2025-12-24 16:51:54.144","level":"INFO","label":"sys","message":"Start scanning component"}
|
|
199
|
+
{"timestamp":"2025-12-24 16:51:55.401","level":"INFO","label":"sys","message":"Complete component scan"}
|
|
200
|
+
{"timestamp":"2025-12-24 16:51:55.401","level":"INFO","label":"sys","message":"Call application initialization method"}
|
|
201
|
+
{"timestamp":"2025-12-24 16:51:55.404","level":"ERROR","label":"sys","message":"Unhandled Rejection at:","splat":"[{}]"}
|
|
202
|
+
{"timestamp":"2025-12-24 16:51:55.408","level":"ERROR","label":"sys","message":"reason: Cannot find module 'koa2-cors'\nRequire stack:\n- D:\\code\\fast-car\\fastcar-koa\\src\\middleware\\KoaCors.ts\n- D:\\code\\fast-car\\fastcar-koa\\test\\simple\\app.ts","splat":"[{\"code\":\"MODULE_NOT_FOUND\",\"requireStack\":[\"D:\\\\code\\\\fast-car\\\\fastcar-koa\\\\src\\\\middleware\\\\KoaCors.ts\",\"D:\\\\code\\\\fast-car\\\\fastcar-koa\\\\test\\\\simple\\\\app.ts\"]}]","stack":"Error: Cannot find module 'koa2-cors'\nRequire stack:\n- D:\\code\\fast-car\\fastcar-koa\\src\\middleware\\KoaCors.ts\n- D:\\code\\fast-car\\fastcar-koa\\test\\simple\\app.ts\n at Function.<anonymous> (node:internal/modules/cjs/loader:1401:15)\n at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (D:\\code\\fast-car\\node_modules\\@cspotcode\\source-map-support\\source-map-support.js:811:30)\n at defaultResolveImpl (node:internal/modules/cjs/loader:1057:19)\n at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1062:22)\n at Function._load (node:internal/modules/cjs/loader:1211:37)\n at TracingChannel.traceSync (node:diagnostics_channel:322:14)\n at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)\n at Module.require (node:internal/modules/cjs/loader:1487:12)\n at require (node:internal/modules/helpers:135:16)\n at KoaApplication.KoaCors (D:\\code\\fast-car\\fastcar-koa\\src\\middleware\\KoaCors.ts:6:19)"}
|
|
203
|
+
{"timestamp":"2025-12-24 16:52:22.882","level":"INFO","label":"sys","message":"Start scanning component"}
|
|
204
|
+
{"timestamp":"2025-12-24 16:52:23.412","level":"INFO","label":"sys","message":"Complete component scan"}
|
|
205
|
+
{"timestamp":"2025-12-24 16:52:23.413","level":"INFO","label":"sys","message":"Call application initialization method"}
|
|
206
|
+
{"timestamp":"2025-12-24 16:52:49.516","level":"INFO","label":"sys","message":"http server is running in 1234"}
|
|
207
|
+
{"timestamp":"2025-12-24 16:52:49.517","level":"INFO","label":"sys","message":"start server koaSimple is run"}
|
|
208
|
+
{"timestamp":"2025-12-24 16:52:49.518","level":"INFO","label":"sys","message":"version 1.0.0"}
|