初始提交

This commit is contained in:
2025-08-24 01:01:26 +08:00
commit e51feb1296
35 changed files with 9348 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
# Web 服务器项目
一个简单的 HTTP Web 服务器,提供 RESTful API。
## 功能特性
- HTTP 服务器
- RESTful API 端点
- JSON 数据处理
- 路由处理
- 中间件支持
- 静态文件服务
## API 端点
- `GET /` - 首页
- `GET /api/users` - 获取用户列表
- `POST /api/users` - 创建新用户
- `GET /api/users/{id}` - 获取特定用户
- `PUT /api/users/{id}` - 更新用户
- `DELETE /api/users/{id}` - 删除用户
## 运行方法
```bash
cd 03-web-server
go run main.go
```
服务器将在 http://localhost:8080 启动
## 使用示例
```bash
# 获取用户列表
curl http://localhost:8080/api/users
# 创建新用户
curl -X POST http://localhost:8080/api/users \
-H "Content-Type: application/json" \
-d '{"name":"张三","email":"zhangsan@example.com"}'
```