mirror of
https://github.com/kataras/iris.git
synced 2025-03-13 22:36:24 +01:00
minor changes on Routing section
parent
04156fa1f5
commit
b77bcaf407
19
Routing.md
19
Routing.md
|
@ -129,18 +129,18 @@ app.PartyFunc("/users", func(users iris.Party) {
|
|||
|
||||
Unlike other routers you'd seen, the Iris' one can handle various route paths without confliction between them.
|
||||
|
||||
Matches all GET requests prefixed with `"/assets/**/*"`, it's a wildcard with `ctx.Params().Get("asset")` equals to any following path after the `/assets/`.
|
||||
|
||||
```go
|
||||
app.Get("/assets/{asset:path}", assetsWildcardHandler)
|
||||
```
|
||||
|
||||
Matches only GET "/".
|
||||
|
||||
```go
|
||||
app.Get("/", indexHandler)
|
||||
```
|
||||
|
||||
Matches all GET requests prefixed with `"/assets/**/*"`, it's a wildcard with `ctx.Params().Get("asset")` equals to any following path after the `/assets/`.
|
||||
|
||||
```go
|
||||
app.Get("/assets/{asset:path}", assetsWildcardHandler)
|
||||
```
|
||||
|
||||
Matches all GET requests prefixed with `"/profile/"`
|
||||
and followed by a single path part.
|
||||
|
||||
|
@ -164,7 +164,7 @@ and followed by a number which should be equal or higher than 1.
|
|||
app.Get("/user/{userid:int min(1)}", getUserHandler)
|
||||
```
|
||||
|
||||
Matches all requests DELETE prefixed with `/users/`
|
||||
Matches all DELETE requests prefixed with `/users/`
|
||||
and following by a number which should be equal or higher than 1.
|
||||
|
||||
```go
|
||||
|
@ -172,11 +172,10 @@ app.Delete("/user/{userid:int min(1)}", deleteUserHandler)
|
|||
```
|
||||
|
||||
|
||||
Matches all GET requests except "/", "/about", anything starts with "/assets/" and the above we've already registered.
|
||||
It does not conflict with the rest of the routes(!).
|
||||
Matches all GET requests except the ones that are already handled by other routes. For example in this case by the above routes; `/`, `/assets/{asset:path}`, `/profile/{username}`, `"/profile/me"`, `/user/{userid:int ...}`. It does not conflict with the rest of the routes(!).
|
||||
|
||||
```go
|
||||
app.Get("{root:path}", rootWildcardHandler)
|
||||
```
|
||||
|
||||
You may wonder what the `{id:uint64}` or `:path` , `min(1)` are. They are (typed) dynamic path parameters and functions can be registered on them. Learn more by reading the [[Path Parameter Types|Routing-path-parameter-types]].
|
||||
You may wonder what the `{id:uint64}` or `:path` or `min(1)` are. They are (typed) dynamic path parameters and functions can be registered on them. Learn more by reading the [[Path Parameter Types|Routing-path-parameter-types]].
|
||||
|
|
Loading…
Reference in New Issue
Block a user