chanjs 1.0.13 → 1.0.14
Sign up to get free protection for your applications and to get access to all the features.
- package/core/chan.js +8 -1
- package/core/lib/config/config.js +3 -0
- package/package.json +7 -6
package/core/chan.js
CHANGED
@@ -3,7 +3,7 @@ const config = require("./lib/config/config.js");
|
|
3
3
|
const path = require("path");
|
4
4
|
const fs = require("fs");
|
5
5
|
const core = require("./lib/core.js");
|
6
|
-
|
6
|
+
const cors = require('cors')
|
7
7
|
/**
|
8
8
|
* @description 基于express封装的mvc框架,遵循约定优于配置原则
|
9
9
|
*/
|
@@ -31,6 +31,8 @@ class Chan {
|
|
31
31
|
this.loadKnex();
|
32
32
|
//生命周期钩子:开始启动
|
33
33
|
this.beforeStart();
|
34
|
+
//解决跨域
|
35
|
+
this.loadCors();
|
34
36
|
//加载模块
|
35
37
|
this.loadModules();
|
36
38
|
//加载插件
|
@@ -112,6 +114,11 @@ class Chan {
|
|
112
114
|
cb && cb();
|
113
115
|
}
|
114
116
|
|
117
|
+
//解决跨域
|
118
|
+
loadCors(){
|
119
|
+
Chan.config?.cors?.origin && this.app.use(cors());
|
120
|
+
}
|
121
|
+
|
115
122
|
// 加载插件
|
116
123
|
loadPlugins() {
|
117
124
|
this.loadModules('plugins');
|
package/package.json
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
{
|
2
2
|
"name": "chanjs",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.14",
|
4
4
|
"description": "Chanjs develops a lightweight MVC framework based on express pure JavaScript",
|
5
5
|
"main": "core/chan.js",
|
6
|
-
"module":"core/chan.js",
|
6
|
+
"module": "core/chan.js",
|
7
7
|
"keywords": [
|
8
8
|
"\"chanjs\"",
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
"\"express mvc\"",
|
10
|
+
"\"chancms\"",
|
11
|
+
"\"nodejs\""
|
12
12
|
],
|
13
13
|
"author": "\"明空\"",
|
14
14
|
"license": "ISC",
|
@@ -16,10 +16,11 @@
|
|
16
16
|
"art-template": "^4.13.2",
|
17
17
|
"body-parser": "^1.20.2",
|
18
18
|
"cookie-parser": "^1.4.6",
|
19
|
+
"cors": "^2.8.5",
|
19
20
|
"express": "^4.19.2",
|
20
21
|
"express-art-template": "^1.0.1",
|
21
22
|
"knex": "^3.1.0",
|
22
23
|
"morgan": "^1.10.0",
|
23
24
|
"mysql2": "^3.11.0"
|
24
25
|
}
|
25
|
-
}
|
26
|
+
}
|