package
0.0.0-20240925030927-d1e3643add27
Repository: https://github.com/cloudwego/hertz-examples.git
Documentation: pkg.go.dev
# README
Route
You can learn about how to use hertz route:
- static route
- route group
- use middleware with route group
- parameter route
- use anonymous function or decorator to register routes
- route info
parameter route:
Parameters such as ':name' are called named parameters
, and named parameters only match a single path segment
Pattern: /hertz/:version
/hertz/v0 match
/hertz/v1 match
/hertz/v1/profile no match
/hertz/ no match
Parameters such as '*action' are called wildcard parameters
and they match everything. Therefore, they must be located at the end of the pattern
Pattern: /src/*filepath
/src/ match
/src/somefile.go match
/src/subdir/somefile.go match
# Functions
RegisterAnonFunOrDecRoute Use anonymous function or decorator to register routes.
RegisterGetRoutesInfo Get route info.
RegisterGroupRoute group route.
RegisterGroupRouteWithMiddleware route groups that incorporate middleware.
RegisterParaRoute parameter route.
RegisterRoute static route.