Skip to content

Commit eeb1ce2

Browse files
authored
Update workflow for direct invocation de Koishi
1 parent ddb7237 commit eeb1ce2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

zh-CN/manual/starter/direct.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ npm init
3636
3737
# 安装 Koishi 和相关插件
3838
npm i koishi \
39+
@koishijs/plugin-server \
3940
@koishijs/plugin-console \
4041
@koishijs/plugin-sandbox \
4142
@koishijs/plugin-echo
@@ -49,6 +50,7 @@ yarn init
4950
5051
# 安装 Koishi 和相关插件
5152
yarn add koishi
53+
@koishijs/plugin-server \
5254
@koishijs/plugin-console \
5355
@koishijs/plugin-sandbox \
5456
@koishijs/plugin-echo
@@ -62,16 +64,18 @@ yarn add typescript @types/node esbuild esbuild-register -D
6264

6365
```ts title=index.ts no-extra-header
6466
import { Context } from 'koishi'
67+
import server from '@koishijs/plugin-server'
6568
import console from '@koishijs/plugin-console'
6669
import * as sandbox from '@koishijs/plugin-sandbox'
6770
import * as echo from '@koishijs/plugin-echo'
6871

6972
// 创建一个 Koishi 应用
70-
const ctx = new Context({
71-
port: 5140,
72-
})
73+
const ctx = new Context()
7374

7475
// 启用上述插件
76+
ctx.plugin(server, {
77+
port: 5140,
78+
}) // 提供后端服务
7579
ctx.plugin(console) // 提供控制台
7680
ctx.plugin(sandbox) // 提供调试沙盒
7781
ctx.plugin(echo) // 提供回声指令

0 commit comments

Comments
 (0)