From 0938ef53fdcdb3db23e28f8e270f5efb4dc0d5e3 Mon Sep 17 00:00:00 2001 From: Jake Hedman Date: Sun, 14 Jan 2024 22:32:30 +0100 Subject: [PATCH] Some spelling and grammar fixes --- docs/api/constructor.md | 4 ++-- docs/at-glance.md | 4 ++-- docs/concept/schema.md | 4 ++-- docs/concept/state-decorate.md | 10 +++++----- docs/eden/fetch.md | 6 +++--- docs/eden/installation.md | 8 ++++---- docs/eden/overview.md | 8 ++++---- docs/eden/test.md | 4 ++-- docs/eden/treaty.md | 14 +++++++------- docs/essential/context.md | 10 +++++----- docs/essential/handler.md | 28 +++++++++++++--------------- docs/essential/path.md | 14 +++++++------- docs/essential/plugin.md | 4 ++-- docs/essential/route.md | 14 +++++++------- docs/essential/schema.md | 4 ++-- docs/essential/scope.md | 8 ++++---- docs/index.md | 4 ++-- docs/integrations/astro.md | 4 ++-- docs/integrations/nextjs.md | 6 +++--- docs/integrations/sveltekit.md | 10 +++++----- docs/introduction.md | 4 ++-- docs/life-cycle/after-handle.md | 2 +- docs/life-cycle/before-handle.md | 2 +- docs/life-cycle/on-error.md | 12 ++++++------ docs/life-cycle/on-response.md | 8 ++++---- docs/life-cycle/overview.md | 6 +++--- docs/life-cycle/trace.md | 2 +- docs/patterns/group.md | 4 ++-- docs/patterns/websocket.md | 2 +- 29 files changed, 104 insertions(+), 106 deletions(-) diff --git a/docs/api/constructor.md b/docs/api/constructor.md index 622fb6d3..0b91932b 100644 --- a/docs/api/constructor.md +++ b/docs/api/constructor.md @@ -32,11 +32,11 @@ new Elysia({ ``` ## Listen -`.listen` will config any value for starting server. +`.listen` will configure any value for starting the server. By default `listen` will either accept `number` or `Object`. -For Object, `listen` accept the same value as `Bun.serve`, you can provide any custom one except `serve`. +For Object, `listen` accepts the same value as `Bun.serve`, you can provide any custom one except `serve`. ```typescript // ✅ This is fine diff --git a/docs/at-glance.md b/docs/at-glance.md index da2414e9..f78fbae0 100644 --- a/docs/at-glance.md +++ b/docs/at-glance.md @@ -26,7 +26,7 @@ new Elysia() .listen(3000) ``` -Navigate to [localhost:3000](http://localhost:3000/) should show 'Hello Elysia' as a result. +Navigate to [localhost:3000](http://localhost:3000/) and it should show 'Hello Elysia' as a result. ## Performance Building on Bun and extensive optimization like Static Code Analysis allows Elysia to generate optimized code on the fly. @@ -62,7 +62,7 @@ new Elysia() The above code allows you to create a path parameter with the name of id, the value that passes after `/id/` will be reflected in `params.id`. -In most framework, you need to provide a generic type to the **id** parameter while Elysia understand that `params.id` will always be available and type as **string**. Elysia then infers this type without any manual type reference need. +In most framework, you need to provide a generic type to the **id** parameter while Elysia understand that `params.id` will always be available and type as **string**. Elysia then infers this type without any manual type reference needed. Elysia's goal is to help you write less TypeScript and focus more on Business logic. Let the complex type be handled by the framework. diff --git a/docs/concept/schema.md b/docs/concept/schema.md index a874caf4..c53e2b26 100644 --- a/docs/concept/schema.md +++ b/docs/concept/schema.md @@ -7,11 +7,11 @@ head: - - meta - name: 'description' - content: Schema is a strictly typed definitions, use to infer TypeScript's type and data validation of an incoming request and outgoing response. Elysia's schema validation are based on Sinclair's TypeBox, a TypeScript library for data validation. + content: Schema are strictly typed definitions, used to infer TypeScript's type and data validation of an incoming request and outgoing response. Elysia's schema validation are based on Sinclair's TypeBox, a TypeScript library for data validation. - - meta - property: 'og:description' - content: Schema is a strictly typed definitions, use to infer TypeScript's type and data validation of an incoming request and outgoing response. Elysia's schema validation are based on Sinclair's TypeBox, a TypeScript library for data validation. + content: Schema are strictly typed definitions, used to infer TypeScript's type and data validation of an incoming request and outgoing response. Elysia's schema validation are based on Sinclair's TypeBox, a TypeScript library for data validation. --- # Schema diff --git a/docs/concept/state-decorate.md b/docs/concept/state-decorate.md index 7d7d46d5..22891de9 100644 --- a/docs/concept/state-decorate.md +++ b/docs/concept/state-decorate.md @@ -7,22 +7,22 @@ head: - - meta - name: 'description' - content: You can extend Elysia to fits your need with ".state" and ".decorate" to add custom value to the "Context", and handler, for example. Database connection, utility function, or cookie. + content: You can extend Elysia to fit your needs with ".state" and ".decorate" to add custom value to the "Context", and handler, for example. Database connection, utility function, or cookie. - - meta - property: 'og:description' - content: You can extend Elysia to fits your need with ".state" and ".decorate" to add custom value to the "Context", and handler, for example. Database connection, utility function, or cookie. + content: You can extend Elysia to fit your needs with ".state" and ".decorate" to add custom value to the "Context", and handler, for example. Database connection, utility function, or cookie. --- # State and Decorate -You can extend Elysia to fit your need. This is useful when you need to access extra values in a handler (e.g. a database connection). +You can extend Elysia to fit your needs. This is useful when you need to access extra values in a handler (e.g. a database connection). In summary: - `state`: assign value to `Context.store` (a global state object of the Elysia instance) - `decorate`: assign value to `Context` ::: tip -`Context` is a parameter in the callback of handler. +`Context` is a parameter in the callback of the handler. ::: ### Example @@ -41,7 +41,7 @@ app - `getDate` is registered using `decorate`, and accessible via `Context.getDate`. ## Remap -By providing a function as a first parameters, the callback will accept current value, allowing us to remap the value to anything we like. +By providing a function as the first parameter, the callback will accept the current value, allowing us to remap the value to anything we like. ```typescript app diff --git a/docs/eden/fetch.md b/docs/eden/fetch.md index cec91f68..26d1799b 100644 --- a/docs/eden/fetch.md +++ b/docs/eden/fetch.md @@ -103,8 +103,8 @@ const { id, name } = nendoroid ## When should I use Eden Fetch over Eden Treaty Using Eden Treaty requires a lot of down-level iteration to map all possible types in a single go, while in contrast, Eden Fetch can be lazily executed until you pick a route. -With complex types and lot of server routes, using Eden Treaty on a low-end development device can lead to slow type inference and auto-completion. +With complex types and a lot of server routes, using Eden Treaty on a low-end development device can lead to slow type inference and auto-completion. -But as Elysia has tweak and optimized a lot of types and inference, Eden Treaty can be perform very well in the considerable amount of routes. +But as Elysia has tweaked and optimized a lot of types and inference, Eden Treaty can perform very well in the considerable amount of routes. -If your single process contains **more than 500 routes**, and you need to consume all of the routes **in a single frontend codebase**, then you might want to use Eden Fetch as it has a significant better TypeScript performance than Eden Treaty. +If your single process contains **more than 500 routes**, and you need to consume all of the routes **in a single frontend codebase**, then you might want to use Eden Fetch as it has a significantly better TypeScript performance than Eden Treaty. diff --git a/docs/eden/installation.md b/docs/eden/installation.md index 68c1114c..ca921c53 100644 --- a/docs/eden/installation.md +++ b/docs/eden/installation.md @@ -22,7 +22,7 @@ bun add -d elysia ``` ::: tip -Eden need Elysia to infers utilities type. +Eden needs Elysia to infer utilities type. Make sure to install Elysia with the version matching on the server. ::: @@ -68,7 +68,7 @@ client.mirror.post({ ``` ## Gotcha -Sometime Eden may not infers type from Elysia correctly, the following are the most common workaround to fix Eden type inference. +Sometimes Eden may not infer type from Elysia correctly, the following are the most common workaround to fix Eden type inference. ### Type Strict Make sure to enable strict mode in **tsconfig.json** @@ -86,9 +86,9 @@ Eden depends Elysia class to import Elysia instance and infers type correctly. Make sure that both client and server have a matching Elysia version. ### TypeScript version -Elysia is using a newer feature and syntax of TypeScript to infers type in a most performance way, feature like Const Generic, Template Literal are heavily use. +Elysia uses newer features and syntax of TypeScript to infer types in a the most performant way. Features like Const Generic and Template Literal are heavily used. -Make sure your client have a **minimum TypeScript version if >= 5.0** +Make sure your client has a **minimum TypeScript version if >= 5.0** ### Method Chaining To make Eden works, Elysia must be using **method chaining** diff --git a/docs/eden/overview.md b/docs/eden/overview.md index 65f26733..fbdc47a9 100644 --- a/docs/eden/overview.md +++ b/docs/eden/overview.md @@ -7,11 +7,11 @@ head: - - meta - name: 'description' - content: Elysia support end-to-end type safety with Elysia Eden since start. End-to-end type-safety refers to a system in which every component of the system is checked for type consistency, meaning that data is passed between components only if the types of the data are compatible. + content: Elysia supports end-to-end type safety with Elysia Eden since start. End-to-end type-safety refers to a system in which every component of the system is checked for type consistency, meaning that data is passed between components only if the types of the data are compatible. - - meta - property: 'og:description' - content: Elysia support end-to-end type safety with Elysia Eden since start. End-to-end type-safety refers to a system in which every component of the system is checked for type consistency, meaning that data is passed between components only if the types of the data are compatible. + content: Elysia supports end-to-end type safety with Elysia Eden since start. End-to-end type-safety refers to a system in which every component of the system is checked for type consistency, meaning that data is passed between components only if the types of the data are compatible. --- # End-to-End Type-Safety @@ -49,7 +49,7 @@ Others framework that support e2e type safety: Hover over variable and function to see type definition. ::: --> -Elysia allows you change the type on server and it will be instantly reflected on the client, helping with auto-completion and type-enforcement. +Elysia allows you to change the type on the server and it will be instantly reflected on the client, helping with auto-completion and type-enforcement. ## Eden Eden is a RPC-like client to connect Elysia **end-to-end type safety** using only TypeScript's type inference instead of code generation. @@ -104,7 +104,7 @@ const data = await fetch('/name/:name', { }) ``` -Using Eden Treaty with a complex type and lot of routes (more than 500 routes per server) on a low-end development device can lead to slow type inference and auto-completion. +Using Eden Treaty with a complex type and a lot of routes (more than 500 routes per server) on a low-end development device can lead to slow type inference and auto-completion. Eden Fetch is an alternative and solution for fastest type inference possible while providing full type support like Eden Treaty. diff --git a/docs/eden/test.md b/docs/eden/test.md index 1c18f519..1ed0d13e 100644 --- a/docs/eden/test.md +++ b/docs/eden/test.md @@ -25,7 +25,7 @@ Using Eden, we can create an integration test with end-to-end type safety and au > Using Eden Treaty to create tests by [irvilerodrigues on Twitter](https://twitter.com/irvilerodrigues/status/1724836632300265926) ## Setup -We can use [Bun test](https://bun.sh/guides/test/watch-mode) to create test. +We can use [Bun test](https://bun.sh/guides/test/watch-mode) to create tests. Create **test/index.test.ts** in the root of project directory with the following: @@ -56,4 +56,4 @@ Then we can perform tests by running **bun test** bun test ``` -This allows us to perform integration test programmatically instead of manual fetch while supporting type checking automatically. +This allows us to perform integration tests programmatically instead of manual fetch while supporting type checking automatically. diff --git a/docs/eden/treaty.md b/docs/eden/treaty.md index 73c1c084..c55ad43b 100644 --- a/docs/eden/treaty.md +++ b/docs/eden/treaty.md @@ -7,11 +7,11 @@ head: - - meta - name: 'og:description' - content: Eden Treaty is a 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. + 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. - - meta - name: 'og:description' - content: Eden Treaty is a 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. + 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. --- # Eden Treaty @@ -81,7 +81,7 @@ Eden will transform `/` into `.` which can be called with a registered `method`, - **/nested/path** -> .nested.path ### Path parameters -Path parameters will be mapped to automatically by their name in the URL. +Path parameters will be mapped automatically by their name in the URL. - **/id/:id** -> .id.`` - eg: .id.hi @@ -108,7 +108,7 @@ Eden Treaty is a fetch wrapper, you can add any valid [Fetch](https://developer. app.post({ $fetch: { headers: { - 'x-origanization': 'MANTIS' + 'x-organization': 'MANTIS' } } }) @@ -148,14 +148,14 @@ const { id, name } = nendoroid Both **data**, and **error** will be typed as nullable until you can confirm their statuses with a type guard. -To put it simply, if fetch is sucessful, data will have a value and error will be null, and vice-versa. +To put it simply, if fetch is successful, data will have a value and error will be null, and vice-versa. ::: tip Error is wrapped with an `Error` with its value return from the server can be retrieve from `Error.value` ::: ### Error type based on status -Both Eden Treaty and Eden Fetch can narrow down an error type based on status code if you explictly provided an error type in the Elysia server. +Both Eden Treaty and Eden Fetch can narrow down an error type based on status code if you explicitly provided an error type in the Elysia server. ```typescript // server.ts @@ -212,7 +212,7 @@ if(error) { ``` ## WebSocket -Eden supports WebSocket using the same API as same as normal route. +Eden supports WebSocket using the same API as a normal route. ```typescript // Server import { Elysia, t } from 'elysia' diff --git a/docs/essential/context.md b/docs/essential/context.md index 41d04290..46e262f3 100644 --- a/docs/essential/context.md +++ b/docs/essential/context.md @@ -7,11 +7,11 @@ head: - - meta - name: 'description' - content: Context is an information of each request from the client, unique to each request with global mutable store. Context can be customize by using state, decorate and derive. + content: Context is information about each request from the client, unique to each request with a global mutable store. Context can be customized using state, decorate and derive. - - meta - property: 'og:description' - content: Context is an information of each request from the client, unique to each request with global mutable store. Context can be customize by using state, decorate and derive. + content: Context is information about each request from the client, unique to each request with a global mutable store. Context can be customized using state, decorate and derive. --- # Context @@ -27,7 +27,7 @@ Elysia context is consists of: - **headers** - [HTTP Header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers), additional information about the request like User-Agent, Content-Type, Cache Hint. - **request** - [Web Standard Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) - **store** - A global mutable store for Elysia instance -- **cookie** - A global mutatable signal store for interacting with Cookie (including get/set) +- **cookie** - A global mutable signal store for interacting with Cookie (including get/set) - **set** - Property to apply to Response: - **status** - [HTTP status](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status), default to 200 if not set. - **headers** - Response headers @@ -40,7 +40,7 @@ Because Elysia only provides essential information about the Request, you can cu Extraction of a user ID or another frequently used function related to the request, for example, into Context itself. You can extend Elysia's context by using: -- **state** - Create a global mutatable state into **Context.store** +- **state** - Create a global mutable state into **Context.store** - **decorate** - Add additional function or property assigned to **Context** - **derive** - Add additional property based on existing property or request which is uniquely assigned to every request. @@ -237,7 +237,7 @@ const app = new Elysia() ## Reference and value To mutate the state, it's recommended to use **reference** to mutate rather than using an actual value. -When accessing the property from JavaScript, if you define a primitive value from an object property as a new value, the reference is lost, the value is treat as new separate value instead. +When accessing the property from JavaScript, if you define a primitive value from an object property as a new value, the reference is lost, the value is treated as new separate value instead. For example: ```typescript diff --git a/docs/essential/handler.md b/docs/essential/handler.md index 04f0ed5b..a4321d4d 100644 --- a/docs/essential/handler.md +++ b/docs/essential/handler.md @@ -7,11 +7,11 @@ head: - - meta - name: 'description' - content: handler is a function that responds to the request for each route. Accepting a request information and return a response to the client. Handler can be registered through Elysia.get / Elysia.post + content: handler is a function that responds to the request for each route. Accepting request information and returning a response to the client. Handler can be registered through Elysia.get / Elysia.post - - meta - property: 'og:description' - content: handler is a function that responds to the request for each route. Accepting a request information and return a response to the client. Handler can be registered through Elysia.get / Elysia.post + content: handler is a function that responds to the request for each route. Accepting request information and returning a response to the client. Handler can be registered through Elysia.get / Elysia.post --- # Handler @@ -35,7 +35,7 @@ new Elysia() ## Request Route handler the request and parse into an easy to use `Context`, unique for each request. -We use context get information about the request. +We use context to get information about the request. Context is always the first parameter of route handler: ```typescript @@ -62,9 +62,9 @@ Elysia context is consists of: - **redirect** - Response as a path to redirect to ::: tip -Context provide several property to help you get information about the request. +Context provides several properties to help you get information about the request. -It's ok to feels overwhelmed by the amount of property, but you don't have to memorize them all, IDE can auto-complete them for you. +It's ok to feel overwhelmed by the amount of properties, but you don't have to memorize them all, an IDE can auto-complete them for you. ::: ## Set @@ -73,7 +73,7 @@ It's ok to feels overwhelmed by the amount of property, but you don't have to me - Set status code of the response, - Append custom headers -This is done by mutate the value of `Context.set`. +This is done by mutating the value of `Context.set`. ```typescript import { Elysia } from 'elysia' @@ -94,7 +94,7 @@ In this example, we create a route handler and **set response status to 418**, a HTTP Status indicates the type of response. If the route handler is executed successfully without error, Elysia will return the status code 200. ::: -You can also set a status code using the common name of the status code instead of using number. +You can also set a status code using the common name of the status code instead of using a number. ```typescript import { Elysia } from 'elysia' @@ -108,14 +108,14 @@ new Elysia() .listen(3000) ``` -Elysia also provide an auto-completion for searching a certain code for your IDE. +Elysia also provides auto-completion for searching a certain code in your IDE. ## Response -Elysia is build on top of Web Standard Request/Response. +Elysia is built on top of Web Standard Request/Response. To comply with the Web Standard, a value returned from route handler will be mapped into a [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) by Elysia. -Helping you can focus on business logic rather than boilerplate code. +Letting you focus on business logic rather than boilerplate code. ```typescript import { Elysia } from 'elysia' @@ -127,7 +127,7 @@ new Elysia() ``` -However, if you prefers an explicity Response class, Elysia also handles that automatically. +If you prefer an explicit Response class, Elysia also handles that automatically. ```typescript import { Elysia } from 'elysia' @@ -138,15 +138,13 @@ new Elysia() ``` ::: tip -Both of the code with primitive value and Response has a near equivalent performance (+- 0.1%). - -Please use the one for your preference not performance. +Using a primitive value or `Response` has near identical performance (+- 0.1%), so pick the one you prefer, regardless of performance. ::: ## Static Content Static Content is a type of handler that always returns the same value, for instance file, hardcoded-value. -In Elysia, static content can be register by providing an actual value instead of an function. +In Elysia, static content can be registered by providing an actual value instead of a function. ```typescript import { Elysia } from 'elysia' diff --git a/docs/essential/path.md b/docs/essential/path.md index a633b381..a4d36c98 100644 --- a/docs/essential/path.md +++ b/docs/essential/path.md @@ -7,11 +7,11 @@ head: - - meta - name: 'description' - content: Path or pathname is an identifier to locate resouces from a server. Elysia uses path and method to lookup the correct resource. Path in Elysia can be categorized into 3 types. Static, Dynamic and Wildcard. + content: Path or pathname is an identifier to locate resources from a server. Elysia uses the path and method to look up the correct resource. Path in Elysia can be categorized into 3 types. Static, Dynamic and Wildcard. - - meta - property: 'og:description' - content: Path or pathname is an identifier to locate resouces from a server. Elysia uses path and method to lookup the correct resource. Path in Elysia can be categorized into 3 types. Static, Dynamic and Wildcard. + content: Path or pathname is an identifier to locate resources from a server. Elysia uses the path and method to look up the correct resource. Path in Elysia can be categorized into 3 types. Static, Dynamic and Wildcard. --- # Path @@ -22,7 +22,7 @@ Path or pathname is an identifier to locate resources from a server. http://localhost:8080/path/page ``` -Elysia uses path and method to lookup the correct resource. +Elysia uses the path and method to look up the correct resource.
URL Representation @@ -48,9 +48,9 @@ Elysia will lookup each request for [route](/essential/route) and response using ## Dynamic path -URL can be both static and dynamic. +URLs can be both static and dynamic. -Static path means a hardcoded string can be used to locate resource from the server while dynamic path matches some part and capture the value to extract extra information. +Static path means a hardcoded string can be used to locate resources from the server while dynamic path matches some part and captures the value to extract extra information. For instance, we can extract the user ID from the pathname, we can do something like: @@ -85,7 +85,7 @@ URL segment is each path that is composed into a full path. Segment is separated by `/`. ![Representation of URL segments](/essential/url-segment.webp) -Path parameters in Elysia are represented by prefixing a segment with ':' follow by a name. +Path parameters in Elysia are represented by prefixing a segment with ':' followed by a name. ![Representation of path parameter](/essential/path-parameter.webp) Path parameters allow Elysia to capture a specific segment of URL. @@ -100,7 +100,7 @@ The named path parameter will then be stored in `Context.params`. ## Multiple path parameter -You can have as much as path parameters as you would like, which will then be stored into a `params`. +You can have as many path parameters as you would like, which will then be stored into a `params`. ```typescript new Elysia() diff --git a/docs/essential/plugin.md b/docs/essential/plugin.md index 9c484d2a..5825547e 100644 --- a/docs/essential/plugin.md +++ b/docs/essential/plugin.md @@ -152,13 +152,13 @@ This allows Elysia to improve performance by reusing the registered plugins inst ::: tip Seed could be anything, varying from a string to a complex object or class. -If the provided value is class, Elysia will then try to use `.toString` method to generate a checksum. +If the provided value is class, Elysia will then try to use the `.toString` method to generate a checksum. ::: ## Service Locator When you apply multiple state and decorators plugin to an instance, the instance will gain type safety. -However, you may notice that when you are trying to use the decorated value in other instance without decorator, you may realize that the type is missing. +However, you may notice that when you are trying to use the decorated value in another instance without decorator, the type is missing. ```typescript import { Elysia } from 'elysia' diff --git a/docs/essential/route.md b/docs/essential/route.md index 47ad3a1c..daac38c7 100644 --- a/docs/essential/route.md +++ b/docs/essential/route.md @@ -7,16 +7,16 @@ head: - - meta - name: 'description' - content: To determine the correct response to a client, web server use path and HTTP method to lookup for the correct resource. This process is known as "routing". We can define a route by calling method named after HTTP verb like `Elysia.get`, `Elysia.post` passing a path and a function to execute when matched. + content: To determine the correct response to a client, the web server uses path and HTTP method to look up for the correct resource. This process is known as "routing". We can define a route by calling a method named after an HTTP verb like `Elysia.get`, `Elysia.post` passing a path and a function to execute when matched. - - meta - property: 'og:description' - content: To determine the correct response to a client, web server use path and HTTP method to lookup for the correct resource. This process is known as "routing". We can define a route by calling method named after HTTP verb like `Elysia.get`, `Elysia.post` passing a path and a function to execute when matched. + content: To determine the correct response to a client, the web server uses path and HTTP method to look up for the correct resource. This process is known as "routing". We can define a route by calling a method named after an HTTP verb like `Elysia.get`, `Elysia.post` passing a path and a function to execute when matched. --- # Route -To determine the correct response to a client, web servers use the request's **path and HTTP method** to lookup the correct resource. +To determine the correct response to a client, web servers use the request's **path and HTTP method** to look up the correct resource. This process is known as **"routing"**. @@ -78,7 +78,7 @@ new Elysia() Elysia HTTP methods accepts the following parameters: - **path**: Pathname -- **function**: Function to respond to client +- **function**: Function to respond to the client - **hook**: Additional metadata You can read more about the HTTP methods on [HTTP Request Methods](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods). @@ -108,7 +108,7 @@ Unlike unit test's mock, **you can expect it to behave like an actual request** ## Custom Method -We can accept custom HTTP Method with `Elysia.route`. +We can accept custom HTTP Methods with `Elysia.route`. ```typescript import { Elysia } from 'elysia' @@ -124,7 +124,7 @@ const app = new Elysia() - **method**: HTTP Verb - **path**: Pathname -- **function**: Function to response to client +- **function**: Function to response to the client - **hook**: Additional metadata When navigating to each method, you should see the results as the following: @@ -164,7 +164,7 @@ If no path matches the defined routes, Elysia will pass the request to `error` l ::: tip HTTP Status is used to indicate the type of response. By default if everything is correct, the server will return a '200 OK' status code (If a route matches and there is no error, Elysia will return 200 as default) -If the server fails to find any route to handle, like in this case, then server shall return a '404 NOT FOUND' status code. +If the server fails to find any route to handle, like in this case, then the server shall return a '404 NOT FOUND' status code. ::: For Elysia, we can handle a custom 404 error by returning a value from 'error` lifecycle like this: diff --git a/docs/essential/schema.md b/docs/essential/schema.md index 14f69aff..ce2e3517 100644 --- a/docs/essential/schema.md +++ b/docs/essential/schema.md @@ -7,11 +7,11 @@ head: - - meta - name: 'description' - content: Schema is a strictly typed definitions, use to infer TypeScript's type and data validation of an incoming request and outgoing response. Elysia's schema validation are based on Sinclair's TypeBox, a TypeScript library for data validation. + content: Schema are strictly typed definitions, used to infer TypeScript's type and data validation of an incoming request and outgoing response. Elysia's schema validation are based on Sinclair's TypeBox, a TypeScript library for data validation. - - meta - property: 'og:description' - content: Schema is a strictly typed definitions, use to infer TypeScript's type and data validation of an incoming request and outgoing response. Elysia's schema validation are based on Sinclair's TypeBox, a TypeScript library for data validation. + content: Schema are strictly typed definitions, used to infer TypeScript's type and data validation of an incoming request and outgoing response. Elysia's schema validation are based on Sinclair's TypeBox, a TypeScript library for data validation. --- # Schema diff --git a/docs/essential/scope.md b/docs/essential/scope.md index fdccf703..24ba54fe 100644 --- a/docs/essential/scope.md +++ b/docs/essential/scope.md @@ -7,11 +7,11 @@ head: - - meta - name: 'description' - content: Elysia offers scope to encapsulate global event, refactor a redundant logic and apply to the certain route using guard, and group. + content: Elysia offers scope to encapsulate global events, refactor redundant logic and apply to the certain route using guard, and group. - - meta - property: 'og:description' - content: Elysia offers scope to encapsulate global event, refactor a redundant logic and apply to the certain route using guard, and group. + content: Elysia offers scope to encapsulate global events, refactor redundant logic and apply to the certain route using guard, and group. --- # Scope @@ -80,7 +80,7 @@ new Elysia() .listen(3000) ``` -## Groupped Guard +## Grouped Guard We can use a group with prefixes by providing 3 parameters to the group. 1. Prefix - Route prefix @@ -189,7 +189,7 @@ The response should be listed as follows: ### Encapsulation -It is important to note that the scoped instance, just like `guard`, the instance will inherit the previous events from the main instance but not expose those registered in the scope. +It is important to note that the scoped instance, just like `guard`, will inherit the previous events from the main instance but not expose those registered in the scope. ```typescript import { Elysia } from 'elysia' diff --git a/docs/index.md b/docs/index.md index 63bde178..9fa036eb 100644 --- a/docs/index.md +++ b/docs/index.md @@ -9,11 +9,11 @@ head: - - meta - name: 'description' - content: Elysia is an ergonomic framework for Humans. With end-to-end type safety and great developer experience. Elysia is familiar, fast, and first class TypeScript support with well-thought integration between service whether it's tRPC, Swagger or WebSocket. Elysia got you cover, start building next generation TypeScript web server today. + content: Elysia is an ergonomic framework for Humans. With end-to-end type safety and great developer experience. Elysia is familiar, fast, and first class TypeScript support with well-thought integration between services whether it's tRPC, Swagger or WebSocket. Elysia got you covered, start building next generation TypeScript web servers today. - - meta - property: 'og:description' - content: Elysia is an ergonomic framework for Humans. With end-to-end type safety and great developer experience. Elysia is familiar, fast, and first class TypeScript support with well-thought integration between service whether it's tRPC, Swagger or WebSocket. Elysia got you cover, start building next generation TypeScript web server today. + content: Elysia is an ergonomic framework for Humans. With end-to-end type safety and great developer experience. Elysia is familiar, fast, and first class TypeScript support with well-thought integration between services whether it's tRPC, Swagger or WebSocket. Elysia got you covered, start building next generation TypeScript web servers today. ---