befly-tpl 3.9.38 → 3.9.40

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/README.md CHANGED
@@ -55,7 +55,6 @@ bun run main.ts
55
55
 
56
56
  ```typescript
57
57
  // apis/user/hello.ts
58
- import { Yes } from 'befly';
59
58
  import type { ApiRoute } from 'befly';
60
59
 
61
60
  export default {
@@ -63,9 +62,12 @@ export default {
63
62
  auth: false, // 公开接口
64
63
  fields: {},
65
64
  handler: async (befly, ctx) => {
66
- return Yes('Hello, Befly!', {
67
- timestamp: Date.now()
68
- });
65
+ return {
66
+ msg: 'Hello, Befly!',
67
+ data: {
68
+ timestamp: Date.now()
69
+ }
70
+ };
69
71
  }
70
72
  } as ApiRoute;
71
73
  ```
@@ -77,7 +79,6 @@ export default {
77
79
  ### TypeScript 全面支持
78
80
 
79
81
  ```typescript
80
- import { Yes } from 'befly';
81
82
  import type { ApiRoute, BeflyContext } from 'befly';
82
83
  import type { User } from './types/models';
83
84
 
@@ -97,7 +98,7 @@ export default {
97
98
  where: { id }
98
99
  });
99
100
 
100
- return Yes('查询成功', user);
101
+ return { msg: '查询成功', data: user };
101
102
  }
102
103
  } as ApiRoute;
103
104
  ```
package/apis/test/hi.ts CHANGED
@@ -1,9 +1,7 @@
1
- import { Yes } from 'befly';
2
-
3
1
  export default {
4
2
  name: '测试接口',
5
3
  handler: async (befly, ctx) => {
6
4
  // 返回成功信息
7
- return Yes('测试成功');
5
+ return '测试成功';
8
6
  }
9
7
  };
package/main.ts CHANGED
@@ -1,4 +1,10 @@
1
1
  import { Befly } from 'befly';
2
2
 
3
- const app = new Befly();
4
- await app.listen();
3
+ export const app = new Befly({
4
+ cors: {
5
+ origin: process.env.CORS_ALLOWED_ORIGIN,
6
+ methods: process.env.CORS_ALLOWED_METHODS
7
+ }
8
+ });
9
+
10
+ await app.start();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "befly-tpl",
3
- "version": "3.9.38",
3
+ "version": "3.9.40",
4
4
  "description": "Befly 3.0 TypeScript Template",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -10,9 +10,7 @@
10
10
  "scripts": {
11
11
  "dev": "NODE_ENV=development bun run main.ts",
12
12
  "start": "NODE_ENV=production bun run main.ts",
13
- "pm2": "bun --bun pm2 start pm2.config.cjs",
14
- "sync:api:dev": "NODE_ENV=development bunx befly sync:api",
15
- "sync:api:prod": "NODE_ENV=production bunx befly sync:api"
13
+ "pm2": "bun --bun pm2 start pm2.config.cjs"
16
14
  },
17
15
  "files": [
18
16
  "apis",
@@ -20,7 +18,6 @@
20
18
  "main.ts",
21
19
  ".npmrc",
22
20
  "bunfig.toml",
23
- "env.ts",
24
21
  "LICENSE",
25
22
  "main.ts",
26
23
  "menu.json",
@@ -31,12 +28,11 @@
31
28
  ],
32
29
  "type": "module",
33
30
  "dependencies": {
34
- "@befly-addon/admin": "1.0.43",
35
- "befly": "3.8.18",
36
- "befly-cli": "3.9.23"
31
+ "@befly-addon/admin": "1.0.45",
32
+ "befly": "3.8.20"
37
33
  },
38
34
  "engines": {
39
35
  "bun": ">=1.3.0"
40
36
  },
41
- "gitHead": "e6cb02eb5d781e3734572200e6797659ff22aee5"
37
+ "gitHead": "e43aefa3abeda7a35669778793d39b23b4180c4e"
42
38
  }
package/env.ts DELETED
@@ -1,12 +0,0 @@
1
- /**
2
- * 项目环境变量配置
3
- * 这里的配置会覆盖 core/env.ts 中的默认配置
4
- */
5
-
6
- import type { EnvConfig } from 'befly/types/env.js';
7
-
8
- /**
9
- * 项目自定义配置
10
- * 只需要配置需要覆盖的字段
11
- */
12
- export const Env: Partial<EnvConfig> = {};