Skip to content

Commit 80d6617

Browse files
committed
Link to newest examples
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent db8e8d1 commit 80d6617

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

docs/platform/typescript-sdk.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ The SDK has two layers:
6969

7070
This two-layer split keeps control-plane operations (which act on the server) cleanly separate from per-VM operations (which act on a specific VM), making the API easier to navigate as the surface grows.
7171

72+
## Examples
73+
74+
Runnable examples live in [`examples/` in the SDK repo](https://github.com/slicervm/sdk-ts/tree/master/examples). Each is a self-contained TypeScript project — `npm install && npm start`.
75+
76+
* [`run-command`](https://github.com/slicervm/sdk-ts/tree/master/examples/run-command) — canonical hello-world: create a VM, run `uname -a`, delete the VM. The same code is shown inline in the Quickstart above.
77+
* [`nginx`](https://github.com/slicervm/sdk-ts/tree/master/examples/nginx) — install nginx via userdata, port-forward host `127.0.0.1:8080` → VM `:80`, fetch the welcome page from the host through the tunnel. Full create-to-fetch-to-teardown in ~6 seconds.
78+
* [`k3s`](https://github.com/slicervm/sdk-ts/tree/master/examples/k3s) — provision a single-node K3s cluster via userdata + `k3sup`, port-forward `:6443` to a local port, rewrite the kubeconfig, and run host-side `kubectl get nodes` against it. Mirrors the [Go k3s example](https://github.com/slicervm/sdk/tree/main/examples/k3s-userdata) but uses port-forwarding so guest IP routability is irrelevant.
79+
* [`ffmpeg`](https://github.com/slicervm/sdk-ts/tree/master/examples/ffmpeg) — full walkthrough on the [Video conversion (TypeScript)](/platform/typescript-video-conversion/) page. Streams a video into the VM via `vm.fs.writeFile`, transcodes with ffmpeg, streams the result back through `execBuffered({ stdio: 'base64' })` — no intermediate file on the guest disk.
80+
7281
## Connecting to the API
7382

7483
Pass a base URL and bearer token:
@@ -308,11 +317,6 @@ The SDK base64-encodes secret data transparently; pass plaintext.
308317
| `client.secrets.patch(name, { data, ... })` | Update a secret |
309318
| `client.secrets.delete(name)` | Delete a secret |
310319

311-
## Examples
312-
313-
* [Video conversion with TypeScript](/platform/typescript-video-conversion/) — create a VM, install ffmpeg, transcode a video, and stream the binary result back via `stdio: 'base64'`. Full e2e walkthrough with runnable source.
314-
* [`examples/` in the SDK repo](https://github.com/slicervm/sdk-ts/tree/master/examples) — more runnable examples.
315-
316320
## See also
317321

318322
* [SDK source on GitHub](https://github.com/slicervm/sdk-ts) — issues, releases, changelog

0 commit comments

Comments
 (0)