create-buntok 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/README.md +22 -0
package/package.json
CHANGED
package/templates/README.md
CHANGED
|
@@ -102,6 +102,28 @@ app.post("/users", async (ctx) => {
|
|
|
102
102
|
});
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
+
### QUERY (Complex Queries)
|
|
106
|
+
|
|
107
|
+
Like GET but with body support - idempotent and cacheable:
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
app.query("/search", async (ctx) => {
|
|
111
|
+
const filters = await ctx.body<{
|
|
112
|
+
query: string;
|
|
113
|
+
limit: number;
|
|
114
|
+
sort: string;
|
|
115
|
+
}>();
|
|
116
|
+
|
|
117
|
+
const results = await db.search(filters);
|
|
118
|
+
return ctx.json({ data: results });
|
|
119
|
+
});
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Why QUERY over GET/POST?**
|
|
123
|
+
- Body allowed (unlike GET)
|
|
124
|
+
- Idempotent & cacheable (unlike POST)
|
|
125
|
+
- Safe for complex queries
|
|
126
|
+
|
|
105
127
|
### Route Group
|
|
106
128
|
|
|
107
129
|
```ts
|