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
docs: add contextual notes about string status names
Add educational paragraphs explaining that status(418) can also be written as status("I'm a teapot") using Elysia's string status name feature. These notes appear where 418 status codes are used in examples, helping readers discover this feature in context.
Here we use `status(418)` which is the "I'm a teapot" status code. You can also use the string name directly: `status("I'm a teapot")`. See <DocLinkhref="/tutorial/getting-started/status-and-headers#status">Status</DocLink> for more on using status codes.
Copy file name to clipboardExpand all lines: docs/tutorial/getting-started/life-cycle/index.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,6 +62,8 @@ new Elysia()
62
62
.get('/2', () =>'Hello Elysia!')
63
63
```
64
64
65
+
Here we use `status(418)` which is the "I'm a teapot" status code. You can also use the string name directly: `status("I'm a teapot")`. See <DocLinkhref="/tutorial/getting-started/status-and-headers#status">Status</DocLink> for more on using status codes.
66
+
65
67
When `beforeHandle` returns a value, it will skip the handler and return the value instead.
66
68
67
69
This is useful for things like authentication, where you want to return a `401 Unauthorized` response if the user is not authenticated.
0 commit comments