|
|
@@ -4,6 +4,7 @@ import { Transform } from 'node:stream';
|
|
|
import { Readable } from 'node:stream';
|
|
|
import { pipeline } from 'node:stream/promises';
|
|
|
import { Hono } from 'hono';
|
|
|
+import { logger } from 'hono/logger'; // 引入 Hono 日志中间件
|
|
|
import { createServer as createNodeServer } from 'node:http';
|
|
|
import process from 'node:process';
|
|
|
import { createAdaptorServer } from '@hono/node-server'
|
|
|
@@ -12,6 +13,9 @@ import { createAdaptorServer } from '@hono/node-server'
|
|
|
// 创建 Hono 应用
|
|
|
const app = new Hono();// API路由
|
|
|
|
|
|
+// 全局使用 Hono 日志中间件(记录所有请求)
|
|
|
+app.use('*', logger()); // 新增:添加请求日志中间件
|
|
|
+
|
|
|
// 常量定义
|
|
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
|
const port = process.env.PORT || 8080;
|