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
Status code is an indicator of how server handle the request.
32
+
Status code is an indicator of how the server handles the request.
33
33
34
34
You must have heard of the infamous **404 Not Found** when you visit a non-existing page.
35
35
36
36
That's a **status code**.
37
37
38
-
By default, Elysia will return **200 OK** for successful request.
38
+
By default, Elysia will return **200 OK** for a successful request.
39
39
40
40
Elysia also returns many other status codes depending on the situation like:
41
41
- 400 Bad Request
42
42
- 422 Unprocessable Entity
43
43
- 500 Internal Server Error
44
44
45
-
You can also return a status code by return your response in a `status` function.
45
+
You can also return a status code by returning your response using a `status` function.
46
46
47
47
```typescript
48
48
import { Elysia } from'elysia'
@@ -55,7 +55,8 @@ new Elysia()
55
55
See <DocLinkhref="/essential/handler#status">Status</DocLink>.
56
56
57
57
## Redirect
58
-
Similarly, you can also redirect the request to another URL returning a `redirect` function.
58
+
59
+
Similarly, you can also redirect the request to another URL by returning a `redirect` function.
59
60
60
61
```typescript
61
62
import { Elysia } from'elysia'
@@ -68,9 +69,8 @@ new Elysia()
68
69
See <DocLinkhref="/essential/handler#redirect">Redirect</DocLink>.
69
70
70
71
## Headers
71
-
Unlike, status code, and redirect where you can return directly.
72
72
73
-
It's likely that you might set headers multiple times in your application.
73
+
Unlike status code and redirect, which you can return directly, you might need to set headers multiple times in your application.
74
74
75
75
That's why instead of returning a `headers` function, Elysia provides a `set.headers` object to set headers.
76
76
@@ -86,7 +86,7 @@ new Elysia()
86
86
.listen(3000)
87
87
```
88
88
89
-
Because `headers`is a **request headers**, Elysia distinguish between request headers and response headers by prefixing **set.headers** for response.
89
+
Because `headers`represents **request headers**, Elysia distinguishes between request headers and response headers by prefixing **set.headers** for response.
90
90
91
91
See <DocLinkhref="/essential/handler#set-headers">Headers</DocLink>.
0 commit comments