抽到了 Elysia 肯定是要学一下的,官方文档:[https://elysia.zhcndoc.com/](https://elysia.zhcndoc.com/)

下载 bun

Elysia 针对 Bun 进行了优化,Bun 是一种旨在作为 Node.js 的直接替代品的 JavaScript 运行时。下载好记得添加到环境变量里

1
2
3
4
5
6
7
PS D:\Elysia> powershell -c "irm bun.sh/install.ps1 | iex"
########################################################################################### 100.0%
Bun 1.3.4 was installed successfully!
The binary is located at C:\Users\gaohang\.bun\bin\bun.exe

To get started, restart your terminal/editor, then type "bun"
PS D:\Elysia> $env:Path += ";C:\Users\gaohang\.bun\bin"

运行

启动一个新的 Elysia 服务器,该命令会自动设置所有内容。

1
bun create elysia app

完成后,会在目录中看到名为 app 的文件夹。

1
cd app

进入到 app 文件夹内,通过以下命令启动开发服务器:

1
bun dev

效果如下,基本的框架已经成功了

具体的相关代码在 Hello Elysia! 文档里