Skip to content

Files

Latest commit

c86a20d · Dec 15, 2022

History

History
This branch is 23 commits behind cloudwego/hertz-examples:main.

route

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Dec 15, 2022
Dec 15, 2022

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