chanjs 1.0.25 → 1.0.27

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 CHANGED
@@ -85,11 +85,11 @@ Chan.js 基于express 纯js研发的轻量级mvc框架。基于函数式编程
85
85
  ### 运行
86
86
 
87
87
  ```javascript
88
- const Chan = require('Chan');
89
- const chan = new Chan();
88
+ const Chanjs = require("chanjs");
89
+ const chan = new Chanjs();
90
90
  //加载中间件
91
91
  chan.beforeStart(fn);
92
- //加载模块
92
+ //扫描模块
93
93
  chan.start();
94
94
  //启动服务
95
95
  chan.run();
package/core/chan.js CHANGED
@@ -116,15 +116,15 @@ class Chan {
116
116
 
117
117
  //开始启动
118
118
  beforeStart(cb) {
119
- // 初始化一些配置
119
+
120
120
  cb && cb();
121
121
  }
122
122
  //启动
123
123
  start(cb) {
124
+ //加载插件
125
+ this.loadPlugins();
124
126
  //加载模块
125
127
  this.loadModules();
126
- //加载插件
127
- this.loadPlugins();
128
128
  //加载通用路由
129
129
  this.loadCommonRouter();
130
130
  // 初始化一些配置
@@ -273,10 +273,10 @@ class Chan {
273
273
  }
274
274
  }
275
275
 
276
- run() {
276
+ run(cb) {
277
277
  const port = Chan.config.port || "81";
278
278
  this.app.listen(port, () => {
279
- console.log(`Server is running on port ${port}`);
279
+ cb?cb(port):console.log(`Server is running on port ${port}`);
280
280
  });
281
281
  }
282
282
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "chanjs",
3
- "version": "1.0.25",
4
- "description": "Chan.js基于express 纯js研发的轻量级mvc框架。",
3
+ "version": "1.0.27",
4
+ "description": "chanjs基于express 纯js研发的轻量级mvc框架。",
5
5
  "main": "core/chan.js",
6
6
  "module": "core/chan.js",
7
7
  "keywords": [