50190afab0
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
51 lines
832 B
Markdown
51 lines
832 B
Markdown
# Language Backend
|
||
|
||
Go + PostgreSQL 实现的语言学习后台服务。
|
||
|
||
## 快速开始
|
||
|
||
```bash
|
||
cd backend
|
||
|
||
# 启动开发环境(热重载)
|
||
make dev
|
||
|
||
# 数据库迁移
|
||
make migrate
|
||
|
||
# 重新生成 sqlc 代码
|
||
make sqlc
|
||
|
||
# 运行测试
|
||
make test
|
||
```
|
||
|
||
## 开发端口
|
||
|
||
- API: http://localhost:8080
|
||
- PostgreSQL: localhost:5432
|
||
|
||
## API 文档
|
||
|
||
接口以 `/api/v1` 为前缀。
|
||
|
||
### Categories
|
||
|
||
- `GET /api/v1/categories`
|
||
- `POST /api/v1/categories`
|
||
- `GET /api/v1/categories/:id`
|
||
- `PUT /api/v1/categories/:id`
|
||
- `DELETE /api/v1/categories/:id`(分类下仍有单词时返回 409,code 10005)
|
||
|
||
### Words
|
||
|
||
- `GET /api/v1/words`
|
||
- `POST /api/v1/words`
|
||
- `GET /api/v1/words/:id`
|
||
- `PUT /api/v1/words/:id`
|
||
- `DELETE /api/v1/words/:id`
|
||
|
||
## 环境变量
|
||
|
||
复制 `.env.example` 为 `.env` 并按需修改。
|