Skip to content

Commit 48ba52e

Browse files
authored
Update life-cycle.md
1 parent 8f21920 commit 48ba52e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/essential/life-cycle.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ head:
1616

1717
# Life Cycle
1818

19-
Also knows as middleware with name in Express or Hook in Fastify.
19+
Also known as middleware with name in Express or Hook in Fastify.
2020

2121
Imagine we want to return a text of HTML.
2222

2323
We need to set **"Content-Type"** headers as **"text/html"** to for browser to render HTML.
2424

25-
Explicitly specify that response is HTML could be repetitive if there are a lot of handlers, says ~200 endpoints.
25+
Explicitly specifying that response is HTML could be repetitive if there are a lot of handlers, says ~200 endpoints.
2626

27-
We can see a duplicated code for just to specify that response is HTML.
27+
We can see a duplicated code for just specifying that response is HTML.
2828

2929
But what if after we sent a response, we could detect if a response is an HTML string then append headers automatically?
3030

@@ -46,7 +46,7 @@ Most of the events you are going to use are highlighted in the blue area but to
4646
Elysia does the following for every request:
4747

4848
1. **Request**
49-
- Notify new event is received, providing only the most minimal context to reduce overhead
49+
- Notify when a new event is received, providing only the most minimal context to reduce overhead
5050
- Best for:
5151
- Caching
5252
- Analytics
@@ -87,15 +87,15 @@ These events are designed to help you decouple code into smaller reusable pieces
8787

8888
## Hook
8989

90-
We refer to each function that intercepts the life cycle event as **"hook"**, as the function hook into the lifecycle event.
90+
We refer to each function that intercepts the life cycle event as **"hook"**, as the function hooks into the lifecycle event.
9191

9292
Hooks can be categorized into 2 types:
9393

9494
1. Local Hook: Execute on a specific route
9595
2. Interceptor Hook: Execute on every route
9696

9797
::: tip
98-
The hook will accept the same Context as a handler, you can imagine you adding a route handler but at a specific point.
98+
The hook will accept the same Context as a handler, you can imagine adding a route handler but at a specific point.
9999
:::
100100

101101
## Local Hook
@@ -187,4 +187,4 @@ Console should log as the following:
187187
1
188188
2
189189
3
190-
```
190+
```

0 commit comments

Comments
 (0)