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(migrate): highlight Elysia string status name advantage
Adds tip boxes to all migration guides highlighting that Elysia supports
both numeric and string status names, unlike Express/Fastify/Hono which
only accept numeric codes.
This is a genuine DX advantage worth showcasing to users migrating from
other frameworks.
Copy file name to clipboardExpand all lines: docs/migrate/from-trpc.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -517,6 +517,18 @@ const app = new Elysia()
517
517
518
518
While tRPC has a `next` function to call the next middleware in the queue, Elysia use specific event interceptor for each point in the request pipeline.
519
519
520
+
::: tip
521
+
Like tRPC's string error codes (e.g., `"UNAUTHORIZED"`), Elysia supports both numeric and string status names:
522
+
523
+
```ts
524
+
// Both are equivalent in Elysia
525
+
returnstatus(401)
526
+
returnstatus("Unauthorized")
527
+
```
528
+
529
+
This gives you the readability of tRPC's string codes while staying compliant with HTTP standards. String status names also provide TypeScript autocompletion for all valid HTTP statuses.
0 commit comments