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 CHANGED
@@ -40,7 +40,6 @@ exports.createKnex = function(opt) {
40
40
  password:config.password,
41
41
  database:config.database,
42
42
  charset:config.charset,
43
- filename:config.filename
44
43
  },
45
44
  debug: config.debug,
46
45
  //默认为{min: 2, max: 10}
@@ -0,0 +1,8 @@
1
+ const express = require("express");
2
+ module.exports = (app)=>{
3
+ app.plus = {
4
+ setStatic:function ({prefix,dir,maxAge}) {
5
+ app.use(prefix, express.static(dir, { maxAge: maxAge || 0 }));
6
+ }
7
+ }
8
+ }
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
- //默认home view
26
- const home = path.join(APP_PATH, `modules/web/view`);
27
- //合并插件中的view
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chanjs",
3
- "version": "1.0.41",
3
+ "version": "1.0.42",
4
4
  "description": "chanjs基于express 纯js研发的轻量级mvc框架。",
5
5
  "main": "index.js",
6
6
  "module": "index.js",