Skip to content

Commit

Permalink
docs: clarify documentation about route_layer
Browse files Browse the repository at this point in the history
  • Loading branch information
Maaxxs committed Aug 8, 2023
1 parent cc611b8 commit e7a862f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions axum/src/docs/method_routing/route_layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ Apply a [`tower::Layer`] to the router that will only run if the request matches
a route.

Note that the middleware is only applied to existing routes. So you have to
first add your routes (and / or fallback) and then call `layer` afterwards. Additional
routes added after `layer` is called will not have the middleware added.
first add your routes (and / or fallback) and then call `route_layer`
afterwards. Additional routes added after `route_layer` is called will not have
the middleware added.

This works similarly to [`MethodRouter::layer`] except the middleware will only run if
the request matches a route. This is useful for middleware that return early
Expand Down
5 changes: 3 additions & 2 deletions axum/src/docs/routing/route_layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ Apply a [`tower::Layer`] to the router that will only run if the request matches
a route.

Note that the middleware is only applied to existing routes. So you have to
first add your routes (and / or fallback) and then call `layer` afterwards. Additional
routes added after `layer` is called will not have the middleware added.
first add your routes (and / or fallback) and then call `route_layer`
afterwards. Additional routes added after `route_layer` is called will not have
the middleware added.

This works similarly to [`Router::layer`] except the middleware will only run if
the request matches a route. This is useful for middleware that return early
Expand Down

0 comments on commit e7a862f

Please sign in to comment.