chore: release packages (#405)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2025-12-31 10:11:24 +08:00
committed by GitHub
parent 902c0a1074
commit cc6f12d470
9 changed files with 111 additions and 48 deletions

View File

@@ -1,5 +1,54 @@
# @esengine/server
## 4.2.0
### Minor Changes
- [#404](https://github.com/esengine/esengine/pull/404) [`902c0a1`](https://github.com/esengine/esengine/commit/902c0a10749f80bd8f499b44154646379d359704) Thanks [@esengine](https://github.com/esengine)! - feat(server): add HTTP file-based routing support / 添加 HTTP 文件路由支持
New feature that allows organizing HTTP routes in separate files, similar to API and message handlers.
新功能:支持将 HTTP 路由组织在独立文件中,类似于 API 和消息处理器的文件路由方式。
```typescript
// src/http/login.ts
import { defineHttp } from '@esengine/server';
export default defineHttp<{ username: string; password: string }>({
method: 'POST',
handler(req, res) {
const { username, password } = req.body;
res.json({ token: '...', userId: '...' });
}
});
```
Server configuration / 服务器配置:
```typescript
const server = await createServer({
port: 8080,
httpDir: 'src/http', // HTTP routes directory / HTTP 路由目录
httpPrefix: '/api', // Route prefix / 路由前缀
cors: true
});
```
File naming convention / 文件命名规则:
- `login.ts` → POST /api/login
- `users/profile.ts` → POST /api/users/profile
- `users/[id].ts` → POST /api/users/:id (dynamic routes / 动态路由)
- Set `method: 'GET'` in defineHttp for GET requests / 在 defineHttp 中设置 `method: 'GET'` 以处理 GET 请求
Also includes / 还包括:
- `defineHttp<TBody>()` helper for type-safe route definitions / 类型安全的路由定义辅助函数
- Support for merging file routes with inline `http` config / 支持文件路由与内联 `http` 配置合并
- RPC server supports attaching to existing HTTP server via `server` option / RPC 服务器支持通过 `server` 选项附加到现有 HTTP 服务器
### Patch Changes
- Updated dependencies [[`902c0a1`](https://github.com/esengine/esengine/commit/902c0a10749f80bd8f499b44154646379d359704)]:
- @esengine/rpc@1.1.3
## 4.1.0
### Minor Changes