Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/tutorial/getting-started/handler-and-context/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ new Elysia()
export const testcases = [
{
title: 'Create POST endpoint',
description: 'Let\'s a POST endpoint "/", so we can send a body',
description: 'Let\'s create a POST endpoint "/", so we can send a body',
test: {
request: {
method: 'POST',
Expand All @@ -23,7 +23,7 @@ export const testcases = [
},
{
title: 'Extract Body',
description: "Let's extract a body a return it as `return { body }`",
description: "Let's extract a body and return it as `return { body }`",
test: {
request: {
method: 'POST',
Expand All @@ -45,7 +45,7 @@ export const testcases = [
{
title: 'Extract Query',
description:
"Let's extract a query a return it as `return { body, query }`",
"Let's extract a query and return it as `return { body, query }`",
test: {
request: {
method: 'POST',
Expand All @@ -64,7 +64,7 @@ export const testcases = [
{
title: 'Extract Headers',
description:
"Let's extract a header a return it as `return { body, query, headers }`",
"Let's extract a header and return it as `return { body, query, headers }`",
test: {
request: {
method: 'POST',
Expand Down
14 changes: 7 additions & 7 deletions docs/tutorial/getting-started/status-and-headers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ import { code, testcases } from './data'

# Status

Status code is an indicator of how server handle the request.
Status code is an indicator of how the server handles the request.

You must have heard of the infamous **404 Not Found** when you visit a non-existing page.

That's a **status code**.

By default, Elysia will return **200 OK** for successful request.
By default, Elysia will return **200 OK** for a successful request.

Elysia also returns many other status codes depending on the situation like:
- 400 Bad Request
- 422 Unprocessable Entity
- 500 Internal Server Error

You can also return a status code by return your response in a `status` function.
You can also return a status code by returning your response using a `status` function.

```typescript
import { Elysia } from 'elysia'
Expand All @@ -55,7 +55,8 @@ new Elysia()
See <DocLink href="/essential/handler#status">Status</DocLink>.

## Redirect
Similarly, you can also redirect the request to another URL returning a `redirect` function.

Similarly, you can also redirect the request to another URL by returning a `redirect` function.

```typescript
import { Elysia } from 'elysia'
Expand All @@ -68,9 +69,8 @@ new Elysia()
See <DocLink href="/essential/handler#redirect">Redirect</DocLink>.

## Headers
Unlike, status code, and redirect where you can return directly.

It's likely that you might set headers multiple times in your application.
Unlike status code and redirect, which you can return directly, you might need to set headers multiple times in your application.

That's why instead of returning a `headers` function, Elysia provides a `set.headers` object to set headers.

Expand All @@ -86,7 +86,7 @@ new Elysia()
.listen(3000)
```

Because `headers` is a **request headers**, Elysia distinguish between request headers and response headers by prefixing **set.headers** for response.
Because `headers` represents **request headers**, Elysia distinguishes between request headers and response headers by prefixing **set.headers** for response.

See <DocLink href="/essential/handler#set-headers">Headers</DocLink>.

Expand Down