You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/1-essentials/01-routing.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -538,6 +538,26 @@ use Tempest\Router\Get;
538
538
final readonly class StatelessController { /* … */ }
539
539
```
540
540
541
+
### Custom route decorators
542
+
543
+
Building your own route decorators is done by implementing the {b`\Tempest\Router\RouteDecorator`} interface and marking your decorator as an attribute.
final readonly class Auth implements RouteDecorator
551
+
{
552
+
public function decorate(Route $route): Route
553
+
{
554
+
$route->middleare[] = AuthMiddleware::class;
555
+
556
+
return $route;
557
+
}
558
+
}
559
+
```
560
+
541
561
## Responses
542
562
543
563
All requests to a controller action expect a response to be returned to the client. This is done by returning a `{php}View` or a `{php}Response` object.
0 commit comments