Skip to content

Commit d921ae2

Browse files
gyohzabogeychan
andauthored
🔧 fix: grouping docs (#246)
* 📘 doc: adjust and fix text - Adjust grammar; - Fix route example. * 📘 doc: improve titles * 🔨 refactor: change file name for consistency * 🔧 fix: adjust Grouping config entry * 🔧 fix: adjust route name +menu label --------- Co-authored-by: bogeychan <[email protected]>
1 parent 5a7035b commit d921ae2

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

‎docs/.vitepress/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ export default defineConfig({
256256
collapsed: true,
257257
items: [
258258
{
259-
text: 'Group',
260-
link: '/patterns/group'
259+
text: 'Grouping Routes',
260+
link: '/patterns/grouping-routes'
261261
},
262262
{
263263
text: 'Cookie',

‎docs/patterns/group.md renamed to ‎docs/patterns/grouping-routes.md

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

88
- - meta
99
- name: 'description'
10-
content: Grouping allows you to set prefix for multiple route once, with ".group". Suppose you have many paths with the same prefix instead of writing many same prefixes, you can group them using a single ".group" method
10+
content: Grouping allows you to set prefixes for multiple routes at once, with ".group". Suppose you have many paths with the same prefix - instead of writing the same prefix multiple times, you can group them using a single ".group" method
1111

1212
- - meta
1313
- property: 'og:description'
14-
content: Grouping allows you to set prefix for multiple route once, with ".group". Suppose you have many paths with the same prefix instead of writing many same prefixes, you can group them using a single ".group" method
14+
content: Grouping allows you to set prefixes for multiple routes at once, with ".group". Suppose you have many paths with the same prefix - instead of writing the same prefix multiple times, you can group them using a single ".group" method
1515
---
1616

17-
# Group
17+
# Grouping Routes
1818

19-
When creating a web server, you would often find multiple routes sharing the same prefix.
19+
When creating a web server, you would often have multiple routes sharing the same prefix:
2020

2121
```typescript
2222
new Elysia()
@@ -26,7 +26,7 @@ new Elysia()
2626
.listen(3000)
2727
```
2828

29-
This can be improve with `Elysia.group`, allowing us to apply prefix to multiple routes a the same time by grouping them together.
29+
This can be improved with `Elysia.group`, allowing us to apply prefixes to multiple routes at the same time by grouping them together:
3030

3131
```typescript
3232
new Elysia()
@@ -39,15 +39,15 @@ new Elysia()
3939
.listen(3000)
4040
```
4141

42-
This code behave the same as our first example and should response as follows:
42+
This code behaves the same as our first example and should be structured as follows:
4343

44-
| Path | Result |
45-
| -------- | ------- |
44+
| Path | Result |
45+
| ------------- | ------- |
4646
| /user/sign-in | Sign in |
47-
| /user/sign-in | Sign up |
48-
| /user/sign-in | Profile |
47+
| /user/sign-up | Sign up |
48+
| /user/profile | Profile |
4949

50-
Group can also accept an optional guard parameter to reduce boilerplate of using group and guard together.
50+
`.group()` can also accept an optional guard parameter to reduce boilerplate of using groups and guards together:
5151

5252
```typescript
5353
new Elysia()
@@ -60,11 +60,11 @@ new Elysia()
6060
.listen(3000)
6161
```
6262

63-
You may find more information about grouped guard in [scope](/essential/scope.html).
63+
You may find more information about grouped guards in [scope](/essential/scope.html).
6464

65-
## Prefix
65+
## Prefixing
6666

67-
We can separate a group into a separate plugin instance to reduce nesting by providing **prefix** to constructor.
67+
We can separate a group into a separate plugin instance to reduce nesting by providing a **prefix** to the constructor.
6868

6969
```typescript
7070
import { Elysia } from 'elysia'

0 commit comments

Comments
 (0)