zenweb 3.0.13 → 3.0.16
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/README.md +35 -16
- package/dist/index.d.ts +3 -2
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -35,34 +35,53 @@ app.start();
|
|
|
35
35
|
src/controller/hello.ts
|
|
36
36
|
```ts
|
|
37
37
|
import { Context, inject, mapping } from 'zenweb';
|
|
38
|
-
import { HelloService } from '../service/hello_service';
|
|
39
38
|
|
|
40
|
-
export class
|
|
41
|
-
@inject
|
|
42
|
-
|
|
39
|
+
export class HelloService {
|
|
40
|
+
@inject ctx: Context;
|
|
41
|
+
private i = 0;
|
|
42
|
+
|
|
43
|
+
say() {
|
|
44
|
+
this.i++;
|
|
45
|
+
return `Hello: ${this.ctx.path}, ${this.i}`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
43
48
|
|
|
49
|
+
export class Index {
|
|
44
50
|
@mapping({ path: '/' })
|
|
45
|
-
index(ctx: Context) {
|
|
46
|
-
ctx.success(
|
|
51
|
+
index(ctx: Context, hello: HelloService) {
|
|
52
|
+
ctx.success(hello.say());
|
|
47
53
|
}
|
|
48
54
|
}
|
|
49
55
|
```
|
|
50
56
|
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
tsconfig.json
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"compilerOptions": {
|
|
61
|
+
"experimentalDecorators": true,
|
|
62
|
+
"emitDecoratorMetadata": true,
|
|
63
|
+
"target": "ES2019",
|
|
64
|
+
"lib": [
|
|
65
|
+
"ES2019"
|
|
66
|
+
],
|
|
67
|
+
"module": "commonjs",
|
|
68
|
+
"strict": true,
|
|
69
|
+
"strictNullChecks": false,
|
|
70
|
+
"sourceMap": true,
|
|
71
|
+
"outDir": "./app"
|
|
72
|
+
},
|
|
73
|
+
"exclude": [
|
|
74
|
+
"node_modules",
|
|
75
|
+
"**/*.spec.ts"
|
|
76
|
+
],
|
|
77
|
+
"include": [
|
|
78
|
+
"src/**/*"
|
|
79
|
+
]
|
|
59
80
|
}
|
|
60
81
|
```
|
|
61
82
|
|
|
62
83
|
```bash
|
|
63
84
|
$ npm run dev
|
|
64
|
-
boot time: 2 ms
|
|
65
|
-
server on: 7001
|
|
66
85
|
```
|
|
67
86
|
|
|
68
87
|
## 内置模块
|
package/dist/index.d.ts
CHANGED
|
@@ -3,13 +3,14 @@ import '@zenweb/log';
|
|
|
3
3
|
import '@zenweb/messagecode';
|
|
4
4
|
import '@zenweb/body';
|
|
5
5
|
import '@zenweb/helper';
|
|
6
|
-
import { Core
|
|
6
|
+
import { Core } from '@zenweb/core';
|
|
7
7
|
import { CreateOptions } from './types';
|
|
8
8
|
export { init, inject, singleton, Context } from '@zenweb/inject';
|
|
9
9
|
export { Router } from '@zenweb/router';
|
|
10
10
|
export { ApiFail } from '@zenweb/api';
|
|
11
11
|
export { Controller, controller, mapping } from '@zenweb/controller';
|
|
12
|
-
export {
|
|
12
|
+
export { Next, SetupFunction } from '@zenweb/core';
|
|
13
|
+
export { Core, CreateOptions, };
|
|
13
14
|
/**
|
|
14
15
|
* @param options 模块配置项
|
|
15
16
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zenweb",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.16",
|
|
4
4
|
"description": "Modular lightweight web framework based on Koa",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"url": "https://github.com/yefei/zenweb/issues"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@zenweb/api": "^2.3.
|
|
35
|
-
"@zenweb/body": "^2.4.
|
|
36
|
-
"@zenweb/controller": "^3.3.
|
|
37
|
-
"@zenweb/core": "^2.4.
|
|
38
|
-
"@zenweb/helper": "^2.10.
|
|
34
|
+
"@zenweb/api": "^2.3.5",
|
|
35
|
+
"@zenweb/body": "^2.4.3",
|
|
36
|
+
"@zenweb/controller": "^3.3.6",
|
|
37
|
+
"@zenweb/core": "^2.4.2",
|
|
38
|
+
"@zenweb/helper": "^2.10.1",
|
|
39
39
|
"@zenweb/inject": "^3.6.1",
|
|
40
40
|
"@zenweb/log": "^2.3.0",
|
|
41
41
|
"@zenweb/messagecode": "^3.0.1",
|