chanjs 1.0.35 → 1.0.36
Sign up to get free protection for your applications and to get access to all the features.
- package/core/lib/index.js +4 -14
- package/package.json +1 -1
package/core/lib/index.js
CHANGED
@@ -7,23 +7,13 @@ const template = require("./middleware/template.js");
|
|
7
7
|
module.exports = async function (app, config) {
|
8
8
|
const { logger, APP_PATH, cookieKey, static, JSON_LIMIT, appName, version } =
|
9
9
|
config;
|
10
|
-
//日志
|
11
|
-
app.use(morgan(logger.level));
|
12
10
|
|
13
|
-
|
11
|
+
app.use(morgan(logger.level));
|
14
12
|
app.use(favicon(path.join(APP_PATH, "public/favicon.ico")));
|
15
|
-
|
16
|
-
//cookie
|
17
13
|
app.use(cookieParser(cookieKey));
|
18
|
-
|
19
|
-
//解析接口 json & url
|
20
14
|
app.use(express.json({ limit: JSON_LIMIT }));
|
21
15
|
app.use(express.urlencoded({ extended: false }));
|
22
|
-
|
23
|
-
//配置模板引擎
|
24
16
|
template(app, config);
|
25
|
-
|
26
|
-
//使用静态资源 ,
|
27
17
|
if (static.length > 0) {
|
28
18
|
static.forEach((item) => {
|
29
19
|
const { prefix, dir, maxAge } = item;
|
@@ -31,11 +21,11 @@ module.exports = async function (app, config) {
|
|
31
21
|
});
|
32
22
|
}
|
33
23
|
|
34
|
-
//设置头信息
|
35
24
|
app.use((req, res, next) => {
|
36
25
|
res.setHeader("Create-By", "Chanjs");
|
37
|
-
res.setHeader("X-Powered-By",
|
38
|
-
res.setHeader(
|
26
|
+
res.setHeader("X-Powered-By", "ChanCMS");
|
27
|
+
res.setHeader("ChanCMS", version);
|
28
|
+
res.setHeader("Server", appName);
|
39
29
|
next();
|
40
30
|
});
|
41
31
|
};
|