chore: change new_hono to Hono.new
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
@@ -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
@@ -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
@@ -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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user