chanjs 1.1.0 → 1.1.2
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 +9 -7
- package/index.js +1 -3
- package/package.json +8 -8
package/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
# Chanjs
|
3
3
|
|
4
|
-
Chanjs 是一个基于
|
4
|
+
Chanjs 是一个基于 Express5+ 构建的轻量级 MVC 框架,完全使用 JavaScript 开发。它体现了函数式编程的概念,提供了卓越的性能、清晰的代码和易于遵循的过程,确保了高可维护性。
|
5
5
|
|
6
6
|
## 特点
|
7
7
|
|
@@ -86,14 +86,16 @@ Chanjs 是一个基于 Express 构建的轻量级 MVC 框架,完全使用 Java
|
|
86
86
|
### 运行
|
87
87
|
|
88
88
|
```javascript
|
89
|
-
|
89
|
+
import Chanjs from "chanjs";
|
90
90
|
const chan = new Chanjs();
|
91
|
-
//
|
91
|
+
// 前置钩子
|
92
92
|
chan.beforeStart(fn);
|
93
|
-
//
|
94
|
-
chan.start();
|
95
|
-
|
96
|
-
|
93
|
+
// 开始加载
|
94
|
+
await chan.start();
|
95
|
+
chan.run((port) => {
|
96
|
+
console.log(`ChanCMS is running on ${port}`);
|
97
|
+
});
|
98
|
+
|
97
99
|
```
|
98
100
|
|
99
101
|
该框架专为寻求简单与功能之间平衡的开发者设计,为构建 Web 应用程序提供了一个强大的基础。
|
package/index.js
CHANGED
@@ -87,6 +87,7 @@ class Chan {
|
|
87
87
|
}
|
88
88
|
//启动
|
89
89
|
async start(cb) {
|
90
|
+
await this.init();
|
90
91
|
await this.loadPlugins();
|
91
92
|
await this.loadModules();
|
92
93
|
await this.loadCommonRouter();
|
@@ -108,10 +109,8 @@ class Chan {
|
|
108
109
|
*/
|
109
110
|
async loadModules(modules = "modules") {
|
110
111
|
const configPath = path.join(Chan.config.APP_PATH, modules);
|
111
|
-
console.log('configPath',configPath);
|
112
112
|
if (fs.existsSync(configPath)) {
|
113
113
|
const dirs = loadWebToEnd(Chan.config[modules]);
|
114
|
-
console.log('dirs',dirs);
|
115
114
|
Chan[modules] = {};
|
116
115
|
|
117
116
|
// 先加载所有服务
|
@@ -153,7 +152,6 @@ class Chan {
|
|
153
152
|
}
|
154
153
|
}
|
155
154
|
}
|
156
|
-
|
157
155
|
|
158
156
|
/**
|
159
157
|
* @description 扫描模块下所有service
|
package/package.json
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
{
|
2
2
|
"type": "module",
|
3
3
|
"name": "chanjs",
|
4
|
-
"version": "1.1.
|
5
|
-
"description": "chanjs基于
|
4
|
+
"version": "1.1.2",
|
5
|
+
"description": "chanjs基于express5 纯js研发的轻量级mvc框架。",
|
6
6
|
"main": "index.js",
|
7
7
|
"module": "index.js",
|
8
8
|
"keywords": [
|
@@ -17,15 +17,15 @@
|
|
17
17
|
"author": "明空",
|
18
18
|
"license": "ISC",
|
19
19
|
"dependencies": {
|
20
|
-
"art-template": "4.13.
|
21
|
-
"body-parser": "
|
22
|
-
"cookie-parser": "1.4.
|
20
|
+
"art-template": "4.13.4",
|
21
|
+
"body-parser": "2.2.0",
|
22
|
+
"cookie-parser": "1.4.7",
|
23
23
|
"cors": "2.8.5",
|
24
|
-
"express": "
|
24
|
+
"express": "5.1.0",
|
25
25
|
"express-art-template": "1.0.1",
|
26
26
|
"knex": "3.1.0",
|
27
27
|
"morgan": "1.10.0",
|
28
|
-
"mysql2": "3.
|
29
|
-
"dayjs": "1.11.
|
28
|
+
"mysql2": "3.14.0",
|
29
|
+
"dayjs": "1.11.13"
|
30
30
|
}
|
31
31
|
}
|