mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vweb: update middleware docs (#18270)
This commit is contained in:
parent
b698a0f459
commit
79657a1a2f
@ -336,7 +336,18 @@ pub fn (mut app App) check_auth () bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
For now you can only add 1 middleware to a route specific function via attributes.
|
You can only add 1 middleware to a route specific function via attributes.
|
||||||
|
|
||||||
|
#### Middleware evaluation order
|
||||||
|
The middleware is executed in the following order:
|
||||||
|
|
||||||
|
1. `before_request`
|
||||||
|
2. The middleware in `app.middlewares`
|
||||||
|
3. The middleware in the `[middleware]` attribute
|
||||||
|
|
||||||
|
If any function of step 2 or 3 returns `false` the middleware functions that would
|
||||||
|
come after it are not executed and the app handler will also not be executed. You
|
||||||
|
can think of it as a chain.
|
||||||
|
|
||||||
### Redirect
|
### Redirect
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user