Routing
Routing
Introduction to route definitions in TurboGo.
Configure Routing
TurboGo provides a flexible and high-performance routing system inspired by popular Go frameworks. At its core, TurboGo uses a custom Tiered Zero-Copy Routing (TZCR) engine that separates static, parametric, and wildcard routes into different tiers for ultra-fast resolution.
Unlike traditional routers, TurboGo precompiles handler chains, passes context using a zero-copy strategy, and avoids unnecessary allocations โ all designed to optimize for concurrency and minimal latency.
๐งช In internal benchmarks, TurboGo consistently outperforms popular frameworks like Gin and Fiber in routing-heavy workloads.
Basic Example
app := TurboGo.New()
app.Get("/hello", func(c *core.Context) {
c.Text(200, "Hello, World!")
})Route Structure
TurboGo uses clear method-based route definitions:
app.Get(path, handler)app.Post(path, handler)app.Put(path, handler)app.Delete(path, handler)- And more...
Grouping Routes
Group routes under a common prefix:
group := app.Group("/api")
group.Get("/users", UserListHandler)
group.Post("/users", CreateUserHandler)