create-surf-app 1.0.2 → 1.0.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.
|
@@ -15,13 +15,14 @@ Use `@surf-ai/sdk/server` in backend routes to talk to Surf data APIs.
|
|
|
15
15
|
|
|
16
16
|
```js
|
|
17
17
|
const { dataApi } = require("@surf-ai/sdk/server");
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
|
|
19
|
+
// Typed methods per domain — check `@surf-ai/sdk/server` typings for the
|
|
20
|
+
// available method on each domain and its exact parameter shape. Don't
|
|
21
|
+
// copy parameters from one method to another; shapes differ per endpoint.
|
|
22
|
+
const data = await dataApi.<domain>.<method>({ /* params */ });
|
|
23
|
+
|
|
24
|
+
// Escape hatch for endpoints not yet in the typed API:
|
|
25
|
+
const raw = await dataApi.get("<domain>/<endpoint>", { /* params */ });
|
|
25
26
|
```
|
|
26
27
|
|
|
27
28
|
## Structure
|
|
@@ -48,11 +49,7 @@ backend/db/schema.js - define database tables
|
|
|
48
49
|
| `/api/cron/:id` | DELETE | Delete a cron task |
|
|
49
50
|
| `/api/cron/:id/run` | POST | Manually trigger a cron task |
|
|
50
51
|
|
|
51
|
-
Auto-registered
|
|
52
|
-
| File | Endpoint |
|
|
53
|
-
|------|----------|
|
|
54
|
-
| `routes/btc.js` | `/api/btc` |
|
|
55
|
-
| `routes/portfolio.js` | `/api/portfolio` |
|
|
52
|
+
Auto-registered: any file at `backend/routes/<name>.js` is mounted at `/api/<name>`.
|
|
56
53
|
|
|
57
54
|
## Database
|
|
58
55
|
|