Skip to content

Commit dbce834

Browse files
committed
fix: kcl server command in the API overview document
Signed-off-by: peefy <xpf6677@163.com>
1 parent 56575d9 commit dbce834

File tree

2 files changed

+9
-10
lines changed
  • docs/reference/xlang-api
  • i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/xlang-api

2 files changed

+9
-10
lines changed

docs/reference/xlang-api/overview.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ x1 = Person{age:101}
7272
`
7373

7474
result := kcl.MustRun("hello.k", kcl.WithCode(k_code)).First()
75-
fmt.Println(result.YAMLString())
75+
fmt.Println(result.GetRawYAMLString())
7676

7777
fmt.Println("----")
7878
fmt.Println("x0.name:", result.Get("x0.name"))
@@ -187,14 +187,18 @@ The C-API provided by KCL does not have a REST-API. The REST-API is defined by P
187187
The RestAPI service can be started in the following way:
188188

189189
```shell
190-
python3 -m pip install kclvm -U
191-
python3 -m gunicorn "kclvm.program.rpc-server.__main__:create_app()" -t 120 -w 4 -k uvicorn.workers.UvicornWorker -b :2021
190+
kcl server
192191
```
193192

194193
The service can then be requested via the POST protocol:
195194

196195
```shell
197-
$ curl -X POST http://127.0.0.1:2021/api:protorpc/BuiltinService.Ping --data '{}'
196+
curl -X POST http://127.0.0.1:2021/api:protorpc/BuiltinService.Ping --data '{}'
197+
```
198+
199+
The output is
200+
201+
```json
198202
{
199203
"error": "",
200204
"result": {}
@@ -287,7 +291,3 @@ $ curl -X POST \
287291
}
288292
}
289293
```
290-
291-
## APIs in other languages
292-
293-
Coming soon

i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/xlang-api/overview.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ KCL 提供的 C-API 并没有 REST-API,REST-API 是通过 Protobuf 定义,
116116
通过以下方式可以启动 RestAPI 服务:
117117
118118
```shell
119-
python3 -m pip install kclvm -U
120-
python3 -m gunicorn "kclvm.program.rpc-server.__main__:create_app()" -t 120 -w 4 -k uvicorn.workers.UvicornWorker -b :2021
119+
kcl server
121120
```
122121

123122
然后可以通过 POST 协议请求服务:

0 commit comments

Comments
 (0)