befly 1.0.0 → 1.0.2
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/apis/health/info.js +1 -1
- package/main.js +3 -4
- package/package.json +2 -2
package/apis/health/info.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Env } from '../../config/env.js';
|
|
|
2
2
|
import { Api } from '../../utils/api.js';
|
|
3
3
|
import { RYes, RNo } from '../../utils/util.js';
|
|
4
4
|
|
|
5
|
-
export default Api.POST('健康检查',
|
|
5
|
+
export default Api.POST('健康检查', false, {}, [], async (befly, ctx) => {
|
|
6
6
|
const info = {
|
|
7
7
|
status: 'ok',
|
|
8
8
|
timestamp: new Date().toISOString(),
|
package/main.js
CHANGED
|
@@ -181,8 +181,7 @@ class BunPii {
|
|
|
181
181
|
const fileName = path.basename(file, '.js');
|
|
182
182
|
const apiPath = path.relative(apiDir, file).replace(/\.js$/, '').replace(/\\/g, '/');
|
|
183
183
|
if (apiPath.indexOf('_') !== -1) continue;
|
|
184
|
-
const api = await import(file);
|
|
185
|
-
const apiInstance = api.default;
|
|
184
|
+
const api = (await import(file)).default;
|
|
186
185
|
if (isType(api.name, 'string') === false || api.name.trim() === '') {
|
|
187
186
|
throw new Error(`接口 ${apiPath} 的 name 属性必须是非空字符串`);
|
|
188
187
|
}
|
|
@@ -202,8 +201,8 @@ class BunPii {
|
|
|
202
201
|
if (isType(api.handler, 'function') === false) {
|
|
203
202
|
throw new Error(`接口 ${apiPath} 的 handler 属性必须是函数`);
|
|
204
203
|
}
|
|
205
|
-
|
|
206
|
-
this.apiRoutes.set(
|
|
204
|
+
api.route = `${api.method.toUpperCase()}/api/${dirName}/${apiPath}`;
|
|
205
|
+
this.apiRoutes.set(api.route, api);
|
|
207
206
|
}
|
|
208
207
|
} catch (error) {
|
|
209
208
|
Logger.error({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "befly",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Buma - 为 Bun 专属打造的 API 接口框架核心引擎",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"README.md",
|
|
50
50
|
"vitest.config.js"
|
|
51
51
|
],
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "672015fdea72a6345b2b8d218bd6c664afa2038b"
|
|
53
53
|
}
|