diff --git a/cli/README.md b/cli/README.md index dad01111e..0ac00b79f 100644 --- a/cli/README.md +++ b/cli/README.md @@ -24,96 +24,50 @@ env GOBIN=/bin go install github.com/yomorun/yomo/cmd/yomo@latest ## Getting Started -### 1. Source +### 1. YoMo-Zipper -#### Write a source app - -See [example/source/main.go](example/source/main.go) - -#### Run - -```sh -go run main.go -``` - -### 2. Stream Function - -#### Init - -Create a stream function +#### Configure YoMo-Zipper `config.yaml` -```sh -yomo init [Name] -``` +See [../example/config.yaml](../example/config.yaml) #### Run ```sh -cd [Name] && yomo run -``` -OR in Production -```sh -cd [Name] && yomo build && ./sl.yomo +yomo serve --config ../example/config.yaml ``` -### 3. Stream Function to store data in DB +### 2. Source -#### Write a stream function +#### Write a source app -See [example/stream-fn-db/app.go](example/stream-fn-db/app.go) +See [../example/9-cli/source/main.go](../example/9-cli/source/main.go) #### Run ```sh -cd example/stream-fn-db && yomo run -``` -OR in Production -```sh -cd example/stream-fn-db && yomo build && ./sl.yomo -``` +cd ../example/9-cli/source -### 4. YoMo-Zipper - -#### Configure YoMo-Zipper `config.yaml` - -```yaml -name: Service -host: localhost -port: 9000 -functions: - - name: Noise - - name: MockDB +go run main.go ``` -#### Run +### 3. Stream Function -```sh -yomo serve --config config.yaml -``` - -## Example +#### Write the serverless function -### Prerequisites -[Installing task](https://taskfile.dev/#/installation) +See [../example/9-cli/sfn/main.go](../example/9-cli/sfn/main.go) -### Simple Example +#### Build -#### Run +Build the app.go to a WebAssembly file. ```sh -task example -``` +cd ../example/9-cli/sfn -### Edge-Mesh - -#### Run US Node - -```sh -task example-mesh-us +yomo build ``` -#### Run EU Node +#### Run ```sh -task example-mesh-eu +yomo run sfn.wasm ``` diff --git a/docs/pages/docs/cli/zipper.mdx b/docs/pages/docs/cli/zipper.mdx index 5fc253cd4..f9eeba361 100644 --- a/docs/pages/docs/cli/zipper.mdx +++ b/docs/pages/docs/cli/zipper.mdx @@ -25,11 +25,6 @@ auth: type: token token: -### sfn ### -functions: - - name: sfn-ai-stream-response - - name: sfn-async-log-events - ### cascading ### downstreams: - zipper-asia_pacific @@ -60,11 +55,6 @@ downstreams: - `type` - the type of the credential, currently only `token` is supported. - `token` - the credential, it is a string. -### StreamFunction Config - -- `functions` - the list of [StreamFunctions][sfn] that allowed to connect this Zipper. - - `name` - the name of the [StreamFunction][sfn], it is used to identify the [StreamFunction][sfn] in the network. - ### Downstreams Config - `downstreams` - the list of downstream Zippers, the data will be forwarded to these Zippers when needed.