befly 1.2.0 → 1.2.1
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/main.js +18 -8
- package/package.json +2 -2
package/main.js
CHANGED
|
@@ -319,13 +319,18 @@ class Befly {
|
|
|
319
319
|
hostname: Env.APP_HOST,
|
|
320
320
|
routes: {
|
|
321
321
|
'/': async (req) => {
|
|
322
|
-
return Response.json(
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
322
|
+
return Response.json(
|
|
323
|
+
{
|
|
324
|
+
code: 0,
|
|
325
|
+
msg: 'Befly 接口服务已启动',
|
|
326
|
+
data: {
|
|
327
|
+
mode: Env.NODE_ENV
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
headers: corsOptions.headers
|
|
327
332
|
}
|
|
328
|
-
|
|
333
|
+
);
|
|
329
334
|
},
|
|
330
335
|
'/api/*': async (req) => {
|
|
331
336
|
try {
|
|
@@ -351,7 +356,10 @@ class Befly {
|
|
|
351
356
|
const api = this.apiRoutes.get(apiPath);
|
|
352
357
|
|
|
353
358
|
// 接口不存在
|
|
354
|
-
if (!api)
|
|
359
|
+
if (!api)
|
|
360
|
+
return Response.json(RNo('接口不存在'), {
|
|
361
|
+
headers: corsOptions.headers
|
|
362
|
+
});
|
|
355
363
|
|
|
356
364
|
const authHeader = req.headers.get('authorization');
|
|
357
365
|
if (authHeader && authHeader.startsWith('Bearer ')) {
|
|
@@ -403,7 +411,9 @@ class Befly {
|
|
|
403
411
|
stack: err.stack
|
|
404
412
|
});
|
|
405
413
|
|
|
406
|
-
return Response.json(RNo('无效的请求参数格式')
|
|
414
|
+
return Response.json(RNo('无效的请求参数格式'), {
|
|
415
|
+
headers: corsOptions.headers
|
|
416
|
+
});
|
|
407
417
|
}
|
|
408
418
|
}
|
|
409
419
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "befly",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
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": "63bf1b29c48afde393f038181900222e6b124fc0"
|
|
53
53
|
}
|