Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions zh-CN/manual/starter/direct.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ npm init

# 安装 Koishi 和相关插件
npm i koishi \
@koishijs/plugin-server \
@koishijs/plugin-console \
@koishijs/plugin-sandbox \
@koishijs/plugin-echo
Expand All @@ -49,6 +50,7 @@ yarn init

# 安装 Koishi 和相关插件
yarn add koishi
@koishijs/plugin-server \
@koishijs/plugin-console \
@koishijs/plugin-sandbox \
@koishijs/plugin-echo
Expand All @@ -62,16 +64,18 @@ yarn add typescript @types/node esbuild esbuild-register -D

```ts title=index.ts no-extra-header
import { Context } from 'koishi'
import server from '@koishijs/plugin-server'
import console from '@koishijs/plugin-console'
import * as sandbox from '@koishijs/plugin-sandbox'
import * as echo from '@koishijs/plugin-echo'

// 创建一个 Koishi 应用
const ctx = new Context({
port: 5140,
})
const ctx = new Context()

// 启用上述插件
ctx.plugin(server, {
port: 5140,
}) // 提供后端服务
ctx.plugin(console) // 提供控制台
ctx.plugin(sandbox) // 提供调试沙盒
ctx.plugin(echo) // 提供回声指令
Expand Down
Loading