mas-server 2.0.56 → 2.0.58

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.
@@ -1,15 +1,14 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
3
  <head>
4
- <meta charset="UTF-8">
5
- <link rel="icon" href="./favicon.ico">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" href="./favicon.ico" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Vite App</title>
8
- <script type="module" crossorigin src="./assets/index-7aebccaa.js"></script>
9
- <link rel="stylesheet" href="./assets/index-a3168eed.css">
8
+ <script type="module" crossorigin src="./assets/index-e07831eb.js"></script>
9
+ <link rel="stylesheet" href="./assets/index-cfd53149.css" />
10
10
  </head>
11
11
  <body>
12
12
  <div id="app"></div>
13
-
14
13
  </body>
15
14
  </html>
package/src/index.ts CHANGED
@@ -56,7 +56,8 @@ export function getApp(
56
56
  path.join(state.DIRNAME, "config/defaultApiConfig.ts")
57
57
  );
58
58
  state.config = config;
59
- state.apiCN = [];
59
+ state.apiCN =
60
+ require(path.join(state.DIRNAME, "config/docNav.ts"))?.default || {};
60
61
  // new express
61
62
  const app = express();
62
63
  // ip限制
package/src/utils/logs.ts CHANGED
@@ -2,6 +2,7 @@ import rateLimit from "express-rate-limit";
2
2
  import morgan from "morgan";
3
3
  import fs from "fs";
4
4
  import * as rfs from "rotating-file-stream";
5
+ import moment from "moment-timezone";
5
6
  const getLogs = (app: any, dir: string) => {
6
7
  // 创建一个日志目录(如果它不存在的话)
7
8
  const logDirectory = dir;
@@ -12,6 +13,9 @@ const getLogs = (app: any, dir: string) => {
12
13
  interval: "1d", // 每天滚动日志
13
14
  path: logDirectory,
14
15
  });
16
+ morgan.token("date", (req, res, tz) => {
17
+ return moment().tz("Asia/Shanghai").format("YYYY-MM-DD HH:mm:ss");
18
+ });
15
19
  app.use(morgan("combined", { stream: accessLogStream }));
16
20
  };
17
21
  export default getLogs;
@@ -0,0 +1,4 @@
1
+ export default {
2
+ "/api/example": "响应示例",
3
+ "/api": "接口",
4
+ };
@@ -4,6 +4,7 @@ export const config: apiConfigTypeItem = {
4
4
  name: "效验数组",
5
5
  methods: "post",
6
6
  validFormat: [Number],
7
+ example: [1, 2],
7
8
  };
8
9
  export default async (req: masReq, res: masRes) => {
9
10
  console.log(req.body);