Files
language/backend/README.md
T

51 lines
832 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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` 并按需修改。