chanjs 1.0.41 → 1.0.42
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/helper.js +0 -1
- package/core/lib/extend.js +8 -0
- package/core/lib/view.js +3 -4
- package/index.js +4 -1
- package/package.json +1 -1
package/core/helper.js
CHANGED
package/core/lib/view.js
CHANGED
@@ -22,10 +22,9 @@ template.defaults.imports.dateFormat = function (date, format) {
|
|
22
22
|
|
23
23
|
module.exports = (app, config) => {
|
24
24
|
const { APP_PATH, views, env } = config;
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
const all = [...views, home];
|
25
|
+
|
26
|
+
//合并插件中的view
|
27
|
+
const all = [...views, 'app/modules/web/view'];
|
29
28
|
|
30
29
|
app.set("view options", {
|
31
30
|
debug: env === "dev",
|
package/index.js
CHANGED
@@ -8,6 +8,7 @@ const Controller = require("./core/lib/controller.js");
|
|
8
8
|
const Service = require("./core/lib/service.js");
|
9
9
|
const cache = require('./core/lib/cache.js');
|
10
10
|
const core = require("./core/lib/index.js");
|
11
|
+
const extend = require("./core/lib/extend.js");
|
11
12
|
/**
|
12
13
|
* @description 基于express封装的mvc框架,遵循约定优于配置原则
|
13
14
|
*/
|
@@ -25,6 +26,7 @@ class Chan {
|
|
25
26
|
|
26
27
|
init() {
|
27
28
|
this.app = express();
|
29
|
+
extend(this.app);
|
28
30
|
this.router = express.Router();
|
29
31
|
this.loadConfig();
|
30
32
|
this.loadExtends();
|
@@ -33,6 +35,7 @@ class Chan {
|
|
33
35
|
this.loadCors();
|
34
36
|
}
|
35
37
|
|
38
|
+
|
36
39
|
loadConfig() {
|
37
40
|
const configPath = path.join(Chan.config.APP_PATH, "config/index.js");
|
38
41
|
if (fs.existsSync(configPath)) {
|
@@ -83,8 +86,8 @@ class Chan {
|
|
83
86
|
}
|
84
87
|
//启动
|
85
88
|
start(cb) {
|
86
|
-
this.loadPlugins();
|
87
89
|
this.loadModules();
|
90
|
+
this.loadPlugins();
|
88
91
|
this.loadCommonRouter();
|
89
92
|
cb && cb();
|
90
93
|
}
|