feat: add middleware implementation

This commit is contained in:
yangshangbo
2025-07-04 16:23:53 +08:00
parent 3764a640c4
commit fd9d2cbbfa
2 changed files with 29 additions and 2 deletions
+6
View File
@@ -101,6 +101,12 @@ fn main() {
}
})
// 日志打印中间件示例
app.use(fn (mut req hono.Request, next fn (mut hono.Request) http.Response) http.Response {
println('[LOG] ${req.url}')
return next(mut req)
})
println('Server starting on :8080')
println('测试静态路由: http://localhost:8080/')
println('测试健康检查: http://localhost:8080/api/health')