Skip to content

Commit ecd8131

Browse files
committed
📘 doc: depreacated context method
1 parent 977783f commit ecd8131

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

bun.lockb

-65.2 KB
Binary file not shown.

docs/concept/handler.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,16 @@ Context's properties consists of
4343
- `headers`: response headers
4444
- `redirect`: redirect to new path
4545
46-
And a few helper methods for convenient usage:
47-
- `status`: Function to set HTTP response status code
48-
- `redirect`: Function to redirect to different path
49-
- `setHeader`: Syntax sugar for setting specific header value
50-
51-
For both context, you can easily access in `Handler` function:
46+
You can access `Context` in `Handler` function:
5247
```typescript
5348
app.post('/', ({ body, set }) => {
5449
const signed = signIn(body)
5550

5651
if(signed)
5752
return 'Welcome back'
58-
else {
59-
set.status = 403
60-
return 'Invalid username or password'
61-
}
53+
54+
set.status = 403
55+
return 'Invalid username or password'
6256
})
6357
```
6458

0 commit comments

Comments
 (0)