1
0
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:
Casper Kuethe 2023-05-26 02:26:00 +02:00 committed by GitHub
parent b698a0f459
commit 79657a1a2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -336,7 +336,18 @@ pub fn (mut app App) check_auth () bool {
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