diff --git a/README.MD b/README.MD index 8fd36ee..c84003b 100644 --- a/README.MD +++ b/README.MD @@ -37,7 +37,7 @@ import hono import net.http fn main() { - mut app := hono.new_hono() + mut app := hono.Hono.new() // 基本路由 app.get('/', fn (mut c hono.Context) http.Response { diff --git a/example.v b/example.v index 590c08b..fe5da66 100644 --- a/example.v +++ b/example.v @@ -4,7 +4,7 @@ import net.http import hono 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 { diff --git a/hono/README.MD b/hono/README.MD index 5aee820..725657c 100644 --- a/hono/README.MD +++ b/hono/README.MD @@ -167,7 +167,7 @@ fn get_content_type(file_path string) string { ```v import hono -mut app := hono.new_hono() +mut app := hono.Hono.new() // 使用默认配置 app.use(hono.serve_static_default()) diff --git a/hono/app.v b/hono/app.v index 40792b8..418effa 100644 --- a/hono/app.v +++ b/hono/app.v @@ -210,13 +210,13 @@ pub fn (mut app Hono) clear_cache() { app.context_hybrid_router.clear_cache() } -pub fn new_hono() Hono { +pub fn Hono.new() Hono { return Hono{ server: http.Server{} routes: map[string]Hono{} base_path: '' context_router: ContextRouter{} - context_hybrid_router: ContextHybridRouter.new() - context_trie_router: ContextTrieRouter.new() + context_hybrid_router: ContextHybridRouter.new() + context_trie_router: ContextTrieRouter.new() } } diff --git a/performance_test_main.v b/performance_test_main.v index 4190966..cb0531c 100644 --- a/performance_test_main.v +++ b/performance_test_main.v @@ -8,7 +8,7 @@ fn main() { println('=== 混合路由性能测试 ===') // 创建应用实例 - mut app := hono.new_hono() + mut app := hono.Hono.new() // 添加静态路由 app.get('/api/users', fn (mut c hono.Context) http.Response {