perf: use picoev as default Server for improve response concurrency

This commit is contained in:
meiseayoung
2025-12-30 17:31:13 +08:00
parent ee2818782b
commit a38aeea614
23 changed files with 2034 additions and 36 deletions
+13
View File
@@ -335,6 +335,19 @@ fn (mut s ServerHanler) exec_context_middlewares(idx int, mut ctx Context, handl
}
pub fn (mut app Hono) listen(port string) {
// 解析端口号
port_num := port.trim(':').int()
if port_num <= 0 {
eprintln('[v-hono] Invalid port: ${port}')
return
}
// 默认使用 picoev 高性能服务器
app.listen_picoev(port_num)
}
// 使用传统 http.Server 启动(保留兼容性)
pub fn (mut app Hono) listen_http(port string) {
app.server.addr = port
app.server.handler = server_hanler_new(app)
// 增加超时配置以支持更好的 Keep-Alive