chore: change new_hono to Hono.new

This commit is contained in:
yangshangbo
2025-07-07 13:51:38 +08:00
parent aca60cb4fa
commit f039f24af1
5 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ import hono
import net.http import net.http
fn main() { fn main() {
mut app := hono.new_hono() mut app := hono.Hono.new()
// 基本路由 // 基本路由
app.get('/', fn (mut c hono.Context) http.Response { app.get('/', fn (mut c hono.Context) http.Response {
+1 -1
View File
@@ -4,7 +4,7 @@ import net.http
import hono import hono
fn main() { fn main() {
mut app := hono.new_hono() mut app := hono.Hono.new()
// 日志中间件 // 日志中间件
app.use(fn (mut c hono.Context, next fn (mut hono.Context) http.Response) http.Response { app.use(fn (mut c hono.Context, next fn (mut hono.Context) http.Response) http.Response {
+1 -1
View File
@@ -167,7 +167,7 @@ fn get_content_type(file_path string) string {
```v ```v
import hono import hono
mut app := hono.new_hono() mut app := hono.Hono.new()
// 使用默认配置 // 使用默认配置
app.use(hono.serve_static_default()) app.use(hono.serve_static_default())
+3 -3
View File
@@ -210,13 +210,13 @@ pub fn (mut app Hono) clear_cache() {
app.context_hybrid_router.clear_cache() app.context_hybrid_router.clear_cache()
} }
pub fn new_hono() Hono { pub fn Hono.new() Hono {
return Hono{ return Hono{
server: http.Server{} server: http.Server{}
routes: map[string]Hono{} routes: map[string]Hono{}
base_path: '' base_path: ''
context_router: ContextRouter{} context_router: ContextRouter{}
context_hybrid_router: ContextHybridRouter.new() context_hybrid_router: ContextHybridRouter.new()
context_trie_router: ContextTrieRouter.new() context_trie_router: ContextTrieRouter.new()
} }
} }
+1 -1
View File
@@ -8,7 +8,7 @@ fn main() {
println('=== 混合路由性能测试 ===') println('=== 混合路由性能测试 ===')
// 创建应用实例 // 创建应用实例
mut app := hono.new_hono() mut app := hono.Hono.new()
// 添加静态路由 // 添加静态路由
app.get('/api/users', fn (mut c hono.Context) http.Response { app.get('/api/users', fn (mut c hono.Context) http.Response {