bkper 4.16.4 → 4.16.5
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/lib/docs/app-building.md +5 -5
- package/package.json +1 -1
package/lib/docs/app-building.md
CHANGED
|
@@ -166,7 +166,7 @@ import type { Env } from '../../env.js';
|
|
|
166
166
|
|
|
167
167
|
const app = new Hono<{ Bindings: Env }>();
|
|
168
168
|
|
|
169
|
-
app.get('/api/books', async c => {
|
|
169
|
+
app.get('/api/v1/books', async c => {
|
|
170
170
|
const bkper = new Bkper();
|
|
171
171
|
const books = await bkper.getBooks();
|
|
172
172
|
return c.json({ books });
|
|
@@ -196,7 +196,7 @@ Use this shape:
|
|
|
196
196
|
- **Services** — Business behavior in server-side service modules.
|
|
197
197
|
- **OpenAPI** — A machine-readable app API spec exposed at `/openapi.json`.
|
|
198
198
|
|
|
199
|
-
The default template generates typed client code from the same OpenAPI contract used by the shipped web client. Keep that contract current so scripts, external clients, and agents can connect without reverse-engineering the UI.
|
|
199
|
+
The default template starts public routes under `/api/v1/*` and generates typed client code from the same OpenAPI contract used by the shipped web client. Keep that contract current so scripts, external clients, and agents can connect without reverse-engineering the UI.
|
|
200
200
|
|
|
201
201
|
App API endpoints use these URLs:
|
|
202
202
|
|
|
@@ -221,7 +221,7 @@ TOKEN="$(bkper auth token)"
|
|
|
221
221
|
|
|
222
222
|
curl \
|
|
223
223
|
-H "Authorization: Bearer ${TOKEN}" \
|
|
224
|
-
"https://my-app.bkper.app/api/books"
|
|
224
|
+
"https://my-app.bkper.app/api/v1/books"
|
|
225
225
|
```
|
|
226
226
|
|
|
227
227
|
Replace `my-app` with the app id from `bkper.yaml`.
|
|
@@ -234,7 +234,7 @@ For deployed apps, server API routes under `/api/*` require a standard bearer to
|
|
|
234
234
|
const token = auth.getAccessToken();
|
|
235
235
|
if (!token) throw new Error('Not authenticated');
|
|
236
236
|
|
|
237
|
-
const response = await fetch('/api/data', {
|
|
237
|
+
const response = await fetch('/api/v1/data', {
|
|
238
238
|
headers: { Authorization: `Bearer ${token}` },
|
|
239
239
|
});
|
|
240
240
|
```
|
|
@@ -246,7 +246,7 @@ When the server route calls Bkper, use `bkper-js` without a token provider:
|
|
|
246
246
|
```ts
|
|
247
247
|
import { Bkper } from 'bkper-js';
|
|
248
248
|
|
|
249
|
-
app.get('/api/books', async c => {
|
|
249
|
+
app.get('/api/v1/books', async c => {
|
|
250
250
|
const bkper = new Bkper();
|
|
251
251
|
const books = await bkper.getBooks();
|
|
252
252
|
return c.json({
|