chanjs 1.0.3 → 1.0.5

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/core/chan.js CHANGED
@@ -41,12 +41,8 @@ class Chan {
41
41
  const configPath = path.join(config.APP_PATH, "config/index.js");
42
42
  if (fs.existsSync(configPath)) {
43
43
  const config = require(configPath);
44
- console.log('111----',Chan.config)
45
44
  Chan.config = Object.assign(Chan.config, config);
46
- console.log('222----',Chan.config)
47
45
  }
48
-
49
-
50
46
  }
51
47
 
52
48
  // 加载扩展
@@ -59,7 +55,6 @@ class Chan {
59
55
  for (let i = 0, file; i < controllers.length; i++) {
60
56
  file = controllers[i];
61
57
  const helper = require(path.join(extendPath, file));
62
-
63
58
  const fileName = file.replace(".js", "");
64
59
  Chan.helper[fileName] = helper;
65
60
  }
@@ -239,8 +234,8 @@ class Chan {
239
234
  loadPlusins() {
240
235
  // 加载插件
241
236
  }
242
-
243
- run(port) {
237
+ run() {
238
+ const port = this.app.config.port || '81';
244
239
  this.app.listen(port, () => {
245
240
  console.log(`Server is running on port ${port}`);
246
241
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chanjs",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Chanjs develops a lightweight MVC framework based on express pure JavaScript",
5
5
  "main": "core/chan.js",
6
6
  "module":"core/chan.js",
package/core/README.MD DELETED
@@ -1,52 +0,0 @@
1
- # <center>Chan.js mvc框架</center>
2
-
3
- Chan.js 基于express 纯js研发的轻量级mvc框架。基于函数式编程思想,性能优越,代码清晰,流程易读,可持续维护高。
4
-
5
- ## 特性
6
-
7
- - 基于express
8
- - 支持es6语法
9
- - 模块化
10
- - 支持多模块路由
11
- - 支持多模块视图
12
- - 支持多模块控制器
13
- - 支持多模块服务
14
- - 插件化
15
- - 轻量级(核心代码300行内)
16
- - 长期维护
17
-
18
- ## 规范 遵循约定优于配置
19
-
20
- ```code
21
- |- app
22
- |- config 配置
23
- |- module 模块1
24
- |- module1 模块1
25
- |- controller 控制器
26
- |- service 服务模型
27
- |- view 视图模板
28
- |- router.js 路由
29
- |- module2 模块2
30
- |- controller 控制器
31
- |- service 服务模型
32
- |- view 视图模板
33
- |- router.js路由
34
- |- extend 扩展
35
- |- middleware 中间件
36
- |- plugin 插件
37
- |- public 静态文件
38
- |- index.js
39
- ```
40
-
41
- ### 初始化流程
42
-
43
- - 初始化
44
- - 加载配置
45
- - 加载模块
46
- - 加载service
47
- - 加载controller
48
- - 加载router
49
- - 加载extend
50
- - 加载plugin
51
- - beforeStart() 挂在从数据库获取的配置合并到配置文件中
52
- - run() 启动服务
package/core/package.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "name": "chanjs",
3
- "version": "0.0.1",
4
- "description": "Chan.js 基于express 纯js研发的轻量级mvc框架。基于函数式编程思想,性能优越,代码清晰,流程易读,可持续维护高。",
5
- "main": "chan.js",
6
- "directories": {
7
- "lib": "lib"
8
- },
9
- "scripts": {
10
- "test": "echo \"Error: no test specified\" && exit 1"
11
- },
12
- "author": "明空",
13
- "license": "ISC"
14
- }