主题
快速入门
¥Quick Start
Elysia 是一个 TypeScript 后端框架,支持多种运行时,但针对 Bun 进行了优化。
¥Elysia is a TypeScript backend framework with multiple runtime support but optimized for Bun.
但是,你可以将 Elysia 与其他运行时(例如 Node.js)一起使用。
¥However, you can use Elysia with other runtimes like Node.js.
Bun
Elysia 针对 Bun 进行了优化,Bun 是一个 JavaScript 运行时,旨在成为 Node.js 的直接替代品。
¥Elysia is optimized for Bun which is a JavaScript runtime that aims to be a drop-in replacement for Node.js.
你可以使用以下命令安装 Bun:
¥You can install Bun with the command below:
bash
curl -fsSL https://bun.sh/install | bash
bash
powershell -c "irm bun.sh/install.ps1 | iex"
Auto Installation
我们建议使用 bun create elysia
启动新的 Elysia 服务器,它会自动设置所有设置。
¥We recommend starting a new Elysia server using bun create elysia
, which sets up everything automatically.
bash
bun create elysia app
完成后,你应该会在目录中看到名为 app
的文件夹。
¥Once done, you should see the folder name app
in your directory.
bash
cd app
通过以下方式启动开发服务器:
¥Start a development server by:
bash
bun dev
导航到 localhost:3000,你应该会看到 "你好,Elysia"。
¥Navigate to localhost:3000 should greet you with "Hello Elysia".
提示
Elysia 附带 dev
命令,可在文件更改时自动重新加载服务器。
¥Elysia ships you with dev
command to automatically reload your server on file change.
后续步骤
¥Next Steps
我们建议你查看以下任一方法:
¥We recommend checking out the either one of the following:
如果你有任何问题,欢迎在我们的 Discord 社区中提问。
¥If you have any questions, feel free to ask in our Discord community.