Skip to content

Commit b6ddcb3

Browse files
authored
Merge branch 'main' into elysia-http-status
2 parents d81bd03 + 4b15771 commit b6ddcb3

File tree

14 files changed

+41
-39
lines changed

14 files changed

+41
-39
lines changed

docs/blog/elysia-05.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ type ContentType = |
177177
| 'application/x-www-form-urlencoded'
178178
```
179179
180-
You can find more detail at [explicity body](/concept/explicit-body) page in concept.
180+
You can find more detail at the [explicit body](/concept/explicit-body) page in concept.
181181
182182
### Numeric Type
183183
We found that one of the redundant task our developers found using Elysia is to parse numeric string.

docs/concept/explicit-body.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ head:
1515
content: By default, Elysia will try to determine body parsing function ahead of time and pick the most suitable function to speed up the process. This allows Elysia to optimize body parser ahead of time, and reduce overhead in compile time but you can explicitly control Elysia to use a certain function.
1616
---
1717

18-
# Explicity Body
18+
# Explicit Body
1919

2020
By default, Elysia will try to determine body parsing function ahead of time and pick the most suitable function to speed up the process.
2121

docs/concept/life-cycle.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ head:
1717
# Life Cycle
1818
Elysia supports Life Cycle events, which trigger at specific moments.
1919

20-
A _Middleware__ or _Hook_ acts as an event listener, allowing you to "hook" into these events. This Hook capability enables you to modify data as it moves through the data pipeline.
20+
A _Middleware_ or _Hook_ acts as an event listener, allowing you to "hook" into these events. This Hook capability enables you to modify data as it moves through the data pipeline.
2121

2222
Whether you aim to implement a custom body parser, generate a tailored response based on your handler, or set up an authentication guard, the Hook empowers you to harness the full potential of Elysia.
2323

docs/concept/numeric.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ head:
1717

1818
# Numeric
1919

20-
Sometime you might find yourself in need of numeric string like extracting path parameter, but it's typed as string and need to be convert to number.
20+
Sometimes you might find yourself in need of numeric string like extracting path parameter, but it's typed as string and need to be convert to number.
2121

2222
Using Elysia's `transform` life-cycle, you can manually parse number to string and re-use the transform function in other handler as well.
2323

@@ -35,7 +35,7 @@ app.get('/id/:id', ({ params: { id } }) => id, {
3535
})
3636
```
3737

38-
However, it's a little bit redundant and require a boilerplate, so Elysia has a custom type to speed up the situation with `t.Numeric`
38+
However, it's a little bit redundant and requires boilerplate, so Elysia has a custom type to speed up the situation with `t.Numeric`
3939

4040
```ts
4141
app.get('/id/:id', ({ params: { id } }) => id, {
@@ -45,11 +45,11 @@ app.get('/id/:id', ({ params: { id } }) => id, {
4545
})
4646
```
4747

48-
This allows us to convert **valid** numeric string to number automatically.
48+
This allows us to convert a **valid** numeric string to a number automatically.
4949

50-
If string is not a valid numeric string, it will throw an error in the runtime and prevent and execution inside the handler.
50+
If the string is not a valid numeric string, it will throw an error in the runtime and prevent execution inside the handler.
5151

52-
You can use numeric type on any property that support schema typing, including:
52+
You can use the numeric type on any property that supports schema typing, including:
5353
- params
5454
- query
5555
- headers

docs/concept/plugin.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ const app = new Elysia()
3333
.listen(8080)
3434
```
3535

36-
Plugin can be registered by using `use` method.
36+
Plugins can be registered by using `use` method.
3737

38-
Registering a plugin will combine types between plugin and current instance, and the scope of hooks and schema get merged as well.
38+
Registering a plugin will combine types between the plugin and current instance, and the scope of hooks and schema get merged as well.
3939

4040
## Separate file
41-
Using plugin pattern, you can define decouple your logic into a separate file.
41+
42+
Using the plugin pattern, you can define and decouple your logic into a separate file.
4243

4344
```ts
4445
// plugin.ts
@@ -64,11 +65,11 @@ import { plugin } from './plugin'
6465
const app = new Elysia().use(plugin).listen(8080)
6566
```
6667

67-
Functional callback will allow user to access main instance values like routes schema, store.
68+
Functional callback will allow a user to access main instance values like routes, schema, store, etc.
6869

6970
## Config
7071

71-
You can customize plugin by creating function to return callback which accepts Elysia.
72+
You can customize a plugin by creating a function to return callback which accepts Elysia.
7273

7374
```typescript
7475
import { Elysia } from 'elysia'

docs/concept/route.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Like Express, and Fastify.
1919

2020
You define route using method as a building block for your server.
2121

22-
By calling `.[method name](path, callback, hook?)`, you attach route to Elysia, and the library will handle the routing for you.
22+
By calling `.[method name](path, callback, hook?)`, you attach the route to Elysia, and the library will handle the routing for you.
2323

2424
For example:
2525
```typescript
@@ -55,7 +55,7 @@ new Elysia()
5555
## Path Parameters
5656
Path parameters can retrieve data from URL.
5757

58-
For example, getting a user id from path like many social media is when you need a path parameters.
58+
For example, getting a user id from path (like many social media) is when you may need path parameters.
5959

6060
```typescript
6161
new Elysia()

docs/concept/state-decorate.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ app
5858
```
5959
6060
## TypeScript
61-
You can type state and decorator explictly using TypeScript with `as`:
61+
You can type state and decorator explicitly using TypeScript with `as`:
6262
```typescript
6363
app
6464
// Will type version as `number | null`
@@ -68,7 +68,7 @@ app
6868
}) => version
6969
```
7070
71-
If explictly typed doesn't type `null` or `undefined`, make sure to set `strict` to `true` in `tsconfig.json`:
71+
If the explicit type doesn't type `null` or `undefined`, make sure to set `strict` to `true` in `tsconfig.json`:
7272
```json
7373
// tsconfig.json
7474
{

docs/patterns/after-handle.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ head:
1717
# After Handle
1818
**After Handle** can transform a response into a new response.
1919

20-
**After Handle** is like `transform`, but instead of transforming incoming request, it is use to transform a response returned from main handler.
20+
**After Handle** is like `transform`, but instead of transforming the incoming request, it is used to transform a response returned from main handler.
2121

2222
Allowing you to remap the returned value into a new value or force the value to early return.
2323

@@ -42,7 +42,7 @@ new Elysia()
4242
The above code will return `3` as a result.
4343

4444
## Early return
45-
Sometime, you may want to prevent the on-going chain of **afterHandle**, just like **beforeHandle**, if you return the value in a **afterHandle** function, it will be an early return and skip the rest of **afterHandle**
45+
Sometimes you may want to prevent the on-going chain of **afterHandle**, just like **beforeHandle**. If you return the value in a **afterHandle** function, it will be an early return and skip the rest of **afterHandle**
4646

4747
```typescript
4848
import { Elysia } from 'elysia'

docs/patterns/body-parser.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ head:
1515
---
1616

1717
# Body Parser
18-
Like Express, body-parser is a function to parse body of an incoming request.
18+
Like Express, body-parser is a function to parse the body of an incoming request.
1919

2020
By default, Elysia will parse the body with content-type of:
2121
- `text/plain`

docs/patterns/error-handling.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ new Elysia()
5454
```
5555

5656
## Local Error
57-
You can assign error handling method to a scope using [hook](/concept/life-cycle.html#local-hook) or [guard](/concept/guard.html)
57+
You can assign an error handling method to a scope using [hook](/concept/life-cycle.html#local-hook) or [guard](/concept/guard.html)
5858
```typescript
5959
app.get('/', () => 'Hello', {
6060
beforeHandle({ set, request: { headers } }) {
@@ -71,7 +71,7 @@ app.get('/', () => 'Hello', {
7171
```
7272

7373
## Custom Error Message
74-
You can provide custom error message by providing `error`:
74+
You can provide a custom error message by providing `error`:
7575
```ts
7676
new Elysia()
7777
.post('/', ({ body }) => body, {
@@ -99,9 +99,9 @@ If no error response is returned, the error will be returned using `error.name`.
9999
:::
100100

101101
## Custom Error
102-
Elysia supports custom error both in type-level and implementaiton level.
102+
Elysia supports custom error both in the type-level and implementation level.
103103

104-
Helping you to easly classify and narrow down the error type for fully type safety with an auto-complete:
104+
Helping you to easily classify and narrow down the error type for full type safety with auto-complete:
105105
```ts
106106
class CustomError extends Error {
107107
constructor(public message: string) {

0 commit comments

Comments
 (0)