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
Copy file name to clipboardExpand all lines: docs/blog/elysia-10.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ head:
45
45
46
46
Elysia 1.0 is the first stable release after development for 1.8 years.
47
47
48
-
Since started, we have always waiting for a framework that focuses on developer experience, velocity, and how to make writing code for humans, not a machine.
48
+
Since we started, we have always been waiting for a framework that focuses on developer experience, velocity, and how to make writing code for humans, not a machine.
49
49
50
50
We battle-test Elysia in various situations, simulate medium and large-scale projects, shipping code to clients and this is the first version that we felt confident enough to ship.
Elysia OpenTelemetry is will **collect span of any library compatible OpenTelemetry standard**, and will apply parent and child span automatically.
92
+
Elysia OpenTelemetry will **collect span of any library compatible with the OpenTelemetry standard**, and will apply parent and child span automatically.
93
93
94
94
In the code above, we apply `Prisma` to trace how long each query took.
Copy file name to clipboardExpand all lines: docs/blog/elysia-12.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,11 +10,11 @@ head:
10
10
11
11
- - meta
12
12
- name: 'description'
13
-
content: Introducing Adapter for universal runtime suppport, Object macro with resolve, Parser with custom name, WebSocket with lifecycle, TypeBox 0.34 with recursive type, and Eden validation inference.
13
+
content: Introducing Adapter for universal runtime support, Object macro with resolve, Parser with custom name, WebSocket with lifecycle, TypeBox 0.34 with recursive type, and Eden validation inference.
14
14
15
15
- - meta
16
16
- property: 'og:description'
17
-
content: Introducing Adapter for universal runtime suppport, Object macro with resolve, Parser with custom name, WebSocket with lifecycle, TypeBox 0.34 with recursive type, and Eden validation inference.
17
+
content: Introducing Adapter for universal runtime support, Object macro with resolve, Parser with custom name, WebSocket with lifecycle, TypeBox 0.34 with recursive type, and Eden validation inference.
18
18
19
19
- - meta
20
20
- property: 'og:image'
@@ -38,9 +38,9 @@ head:
38
38
shadow
39
39
>
40
40
41
-
Named after the song [Φ²](https://youtu.be/b9IkzWO63Fg) from album "At the Fingertip of the Sea" by HoyoMix as used in as in [**"You and Me"**](https://youtu.be/nz_Ra4G57A4).
41
+
Named after the song [Φ²](https://youtu.be/b9IkzWO63Fg) from album "At the Fingertip of the Sea" by HoyoMix as used in [**"You and Me"**](https://youtu.be/nz_Ra4G57A4).
42
42
43
-
Elysia 1.2 focus on commitment to expand universal runtime support and developer experience:
43
+
Elysia 1.2 focuses on commitment to expand universal runtime support and developer experience:
44
44
-[Adapter](#adapter)
45
45
-[Macro with resolve](#macro-with-resolve)
46
46
-[Parser](#parser)
@@ -92,7 +92,7 @@ We will continue to expand support for more runtimes in the future starting with
92
92
- uWebSocket.js
93
93
94
94
### Universal runtime API
95
-
To be comaptible with different runtime, Elysia now wrap over a hand-picked utility function to provide a consistent API across different runtime.
95
+
To be compatible with different runtime, Elysia now wraps over a hand-picked utility function to provide a consistent API across different runtime.
96
96
97
97
For example, in Bun you may use `Bun.file` to return a file response which is not available in Node.
Copy file name to clipboardExpand all lines: docs/blog/elysia-13.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,7 +102,7 @@ When comparing to the same code **without schema**, we see < 2% performance diff
102
102
103
103
This is huge.
104
104
105
-
Previously, you have to choose between safety and performance but as we close the performance gap between using and not using validation. But now you don't have to worry about it.
105
+
Previously, you had to choose between safety and performance as we close the performance gap between using and not using validation. But now you don't have to worry about it.
106
106
107
107
But now, we drop validation overhead from a significant amount to almost near zero without requiring any changes on your side.
108
108
@@ -150,13 +150,13 @@ We can then override a public schema by providing a schema in a route handler wh
150
150

151
151
> Elysia run with default override guard
152
152
153
-
But sometime we **don't want to override** a schema.
153
+
But sometimes we **don't want to override** a schema.
154
154
155
155
Instead we want it to work both allowing us to combine schemas instead of overriding them.
156
156
157
157
Starting from Elysia 1.3, we can do just that.
158
158
159
-
We can now tell Elysia to not to override it and instead treat it as its own by providing a schema as **standalone**.
159
+
We can now tell Elysia not to override it and instead treat it as its own by providing a schema as **standalone**.
160
160
161
161
```ts
162
162
import { Elysia } from'elysia'
@@ -170,7 +170,7 @@ new Elysia()
170
170
})
171
171
```
172
172
173
-
As a result, we have a results that like merging a local and global schema together.
173
+
As a result, we have results that are like merging a local and global schema together.
174
174
175
175

176
176
> Elysia run with standalone merging multiple guard together
@@ -181,7 +181,7 @@ Elysia's type inference is already extremely fast.
181
181
182
182
We are really confident in our optimization of type inference and it's faster than most frameworks that use an express-like syntax.
183
183
184
-
However, our users with really **really** large scale with multiple routes and complex type inference.
184
+
However, our users with really **really** large scale applications with multiple routes and complex type inference.
185
185
186
186
We managed to **reduce type instantiation by half** in most cases, and measured up to 60% improvement in inference speed.
187
187
@@ -195,7 +195,7 @@ This should solve the problem with users who use heavy object/class for example
195
195
As a result, we should end up with faster IDE auto-completion, suggestion, type checking and Eden Treaty.
196
196
197
197
## Performance Improvement
198
-
We have refactored and optimized a lot of internal code which accumulate up to significant improvements.
198
+
We have refactored and optimized a lot of internal code which accumulates up to significant improvements.
Copy file name to clipboardExpand all lines: docs/eden/treaty/response.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,11 @@ head:
7
7
8
8
- - meta
9
9
- name: 'og:description'
10
-
content: Eden Treaty is an object-like representation of an Elysia server, providing an end-to-end type safety, and a significantly improved developer experience. With Eden, we can fetch an API from Elysia server fully type-safe without code generation.
10
+
content: Eden Treaty is an object-like representation of an Elysia server, providing end-to-end type safety and a significantly improved developer experience. With Eden, we can fetch an API from Elysia server fully type-safe without code generation.
11
11
12
12
- - meta
13
13
- name: 'og:description'
14
-
content: Eden Treaty is an object-like representation of an Elysia server, providing an end-to-end type safety, and a significantly improved developer experience. With Eden, we can fetch an API from Elysia server fully type-safe without code generation.
14
+
content: Eden Treaty is an object-like representation of an Elysia server, providing end-to-end type safety and a significantly improved developer experience. With Eden, we can fetch an API from Elysia server fully type-safe without code generation.
By default, Elysia infers `error` and `response` types to TypeScript automatically, and Eden will be providing auto-completion and type narrowing for accurate behavior.
71
71
72
72
::: tip
73
-
If the server responds with an HTTP status >= 300, then the value will be always be `null`, and `error` will have a returned value instead.
73
+
If the server responds with an HTTP status >= 300, then the value will always be `null`, and `error` will have a returned value instead.
Copy file name to clipboardExpand all lines: docs/eden/treaty/unit-test.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,17 +7,17 @@ head:
7
7
8
8
- - meta
9
9
- name: 'og:description'
10
-
content: Eden Treaty is an object-like representation of an Elysia server, providing an end-to-end type safety, and a significantly improved developer experience. With Eden, we can fetch an API from Elysia server fully type-safe without code generation.
10
+
content: Eden Treaty is an object-like representation of an Elysia server, providing end-to-end type safety and a significantly improved developer experience. With Eden, we can fetch an API from Elysia server fully type-safe without code generation.
11
11
12
12
- - meta
13
13
- name: 'og:description'
14
-
content: Eden Treaty is an object-like representation of an Elysia server, providing an end-to-end type safety, and a significantly improved developer experience. With Eden, we can fetch an API from Elysia server fully type-safe without code generation.
14
+
content: Eden Treaty is an object-like representation of an Elysia server, providing end-to-end type safety and a significantly improved developer experience. With Eden, we can fetch an API from Elysia server fully type-safe without code generation.
15
15
---
16
16
17
17
# Unit Test
18
18
According to [Eden Treaty config](/eden/treaty/config.html#urlorinstance) and [Unit Test](/patterns/unit-test), we may pass an Elysia instance to Eden Treaty directly to interact with Elysia server directly without sending a network request.
19
19
20
-
We may use this patterns to create a unit test with end-to-end type safety and type-level test all at once.
20
+
We may use this pattern to create a unit test with end-to-end type safety and type-level test all at once.
21
21
22
22
```typescript twoslash
23
23
// test/index.test.ts
@@ -29,7 +29,7 @@ const app = new Elysia().get('/hello', 'hi')
29
29
const api =treaty(app)
30
30
31
31
describe('Elysia', () => {
32
-
it('return a response', async () => {
32
+
it('returns a response', async () => {
33
33
const { data } =awaitapi.hello.get()
34
34
35
35
expect(data).toBe('hi')
@@ -40,7 +40,7 @@ describe('Elysia', () => {
40
40
```
41
41
42
42
## Type safety test
43
-
To perform a type safety test, simply run **tsc**to test folders.
43
+
To perform a type safety test, simply run **tsc**on test folders.
Copy file name to clipboardExpand all lines: docs/essential/best-practice.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,26 +7,26 @@ head:
7
7
8
8
- - meta
9
9
- name: 'description'
10
-
content: Elysia is pattern agnostic framework, we leave the decision up to you and your team for coding patterns to use. However, we found that there are several who are using MVC pattern (Model-View-Controller) on Elysia, and found it's hard to decouple and handling with types. This page is a guide to use Elysia with MVC pattern.
10
+
content: Elysia is a pattern agnostic framework, we leave the decision up to you and your team for coding patterns to use. However, we found that there are several who are using MVC pattern (Model-View-Controller) on Elysia, and found it's hard to decouple and handle types. This page is a guide to use Elysia with MVC pattern.
11
11
12
12
- - meta
13
13
- property: 'og:description'
14
-
content: Elysia is pattern agnostic framework, we the decision up to you and your team for coding patterns to use. However, we found that there are several who are using MVC pattern (Model-View-Controller) on Elysia, and found it's hard to decouple and handling with types. This page is a guide to use Elysia with MVC pattern.
14
+
content: Elysia is a pattern agnostic framework, we leave the decision up to you and your team for coding patterns to use. However, we found that there are several who are using MVC pattern (Model-View-Controller) on Elysia, and found it's hard to decouple and handle types. This page is a guide to use Elysia with MVC pattern.
15
15
---
16
16
17
17
# Best Practice
18
18
19
19
Elysia is a pattern-agnostic framework, leaving the decision of which coding patterns to use up to you and your team.
20
20
21
-
However, there are several concern from trying to adapt an MVC pattern [(Model-View-Controller)](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) with Elysia, and found it's hard to decouple and handle types.
21
+
However, there are several concerns from trying to adapt an MVC pattern [(Model-View-Controller)](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) with Elysia, and we found it's hard to decouple and handle types.
22
22
23
-
This page is a guide to on how to follows Elysia structure best practice combined with MVC pattern but can be adapted to any coding pattern you like.
23
+
This page is a guide on how to follow Elysia structure best practices combined with MVC pattern but can be adapted to any coding pattern you like.
24
24
25
25
## Folder Structure
26
26
27
27
Elysia is unopinionated about folder structure, leaving you to **decide** how to organize your code yourself.
28
28
29
-
However, **if you doesn't have a specific structure in mind**, we recommended a feature-based folder structure. Where each feature has its own folder containing controllers, services, models.
29
+
However, **if you don't have a specific structure in mind**, we recommend a feature-based folder structure. Where each feature has its own folder containing controllers, services, and models.
0 commit comments