create-buntok 0.1.2 → 0.1.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-buntok",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "CLI tool to create new Buntok projects",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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
@@ -111,6 +133,32 @@ api.get("/users", getUsers);
111
133
  api.post("/users", createUser);
112
134
  ```
113
135
 
136
+ ### Controllers (Decorators)
137
+
138
+ ```ts
139
+ import { Controller, Get } from "buntok";
140
+
141
+ @Controller("/users")
142
+ export class UserController {
143
+ @Get("/")
144
+ getAll(ctx: Context) {
145
+ return ctx.json([{ id: 1 }]);
146
+ }
147
+ }
148
+
149
+ app.registerController(UserController);
150
+ ```
151
+
152
+ ### WebSockets
153
+
154
+ ```ts
155
+ app.ws("/chat", {
156
+ open: (ws) => ws.subscribe("room"),
157
+ message: (ws, msg) => ws.publish("room", msg),
158
+ close: (ws) => console.log("Disconnected"),
159
+ });
160
+ ```
161
+
114
162
  ### Middleware
115
163
 
116
164
  ```ts