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
+1 -1
View File
@@ -31,7 +31,7 @@ fn main() {
return c.html('<h1>Welcome to v-hono!</h1><p>API available at /api</p>')
})
println('Server starting on http://localhost:3000')
println('Server starting on http://127.0.0.1:3000')
println('Routes:')
println(' GET / - Welcome page')
println(' GET /api/users - List users')
@@ -211,7 +211,7 @@ app.route("/api/books", mut books)</pre>
// 打印路由信息
fn print_routes_info() {
println('')
println('📍 服务器地址: http://localhost:8080')
println('📍 服务器地址: http://127.0.0.1:8080')
println('')
println('📚 Books API (/api/books):')
println(' GET /api/books - 获取所有书籍')
@@ -233,16 +233,16 @@ app.route(\'/api/books\', mut books)</pre>
<div class="group">
<h2>🧪 测试命令</h2>
<pre># 测试 all() 方法
curl http://localhost:8080/echo
curl -X POST http://localhost:8080/echo
curl -X PUT http://localhost:8080/echo
curl http://127.0.0.1:8080/echo
curl -X POST http://127.0.0.1:8080/echo
curl -X PUT http://127.0.0.1:8080/echo
# 测试自定义 404
curl http://localhost:8080/not-exist
curl http://127.0.0.1:8080/not-exist
# 测试 Admin 认证中间件
curl http://localhost:8080/admin # 返回 401
curl -H "Authorization: Bearer admin-token" http://localhost:8080/admin # 成功</pre>
curl http://127.0.0.1:8080/admin # 返回 401
curl -H "Authorization: Bearer admin-token" http://127.0.0.1:8080/admin # 成功</pre>
</div>
</body>
</html>'
@@ -251,7 +251,7 @@ curl -H "Authorization: Bearer admin-token" http://localhost:8080/admin # 成
// 打印路由信息
fn print_routes_info() {
println('')
println('📍 服务器地址: http://localhost:8080')
println('📍 服务器地址: http://127.0.0.1:8080')
println('')
println('🆕 新功能:')
println(' - notFound(): 自定义 404 处理器')