> ## Documentation Index
> Fetch the complete documentation index at: https://bun.ll1025.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 使用 Elysia 和 Bun 构建 HTTP 服务器

[Elysia](https://elysiajs.com) 是一个 Bun 优先的 Web 框架，构建在 Bun 的 HTTP、文件系统和热重载 API 之上。使用 `bun create` 开始。

```bash terminal icon="terminal" theme={null}
bun create elysia myapp
cd myapp
bun run dev
```

***

要使用 Elysia 定义 HTTP 路由并启动服务器：

```ts server.ts icon="https://mintcdn.com/span-inc/82N53aP7NFbaCVSl/icons/typescript.svg?fit=max&auto=format&n=82N53aP7NFbaCVSl&q=85&s=787d39d6a7d96d7f9540dc74344eba23" theme={null}
import { Elysia } from "elysia";

const app = new Elysia().get("/", () => "Hello Elysia").listen(8080);

console.log(`🦊 Elysia 正在端口 ${app.server?.port} 上运行...`);
```

***

Elysia 是一个服务器框架，具有类似 Express 的语法、类型推断、中间件、文件上传以及用于 JWT 认证和 tRPC 的插件。它是[最快的 Bun Web 框架](https://github.com/SaltyAom/bun-http-framework-benchmark)之一。

请参见 Elysia [文档](https://elysiajs.com/quick-start.html)。
