1.3 KiB
1.3 KiB
涂鸦丫后台管理系统 - API服务
技术栈
- NestJS 11
- TypeORM
- PostgreSQL
- class-validator
- class-transformer
环境配置
- 复制
.env.example为.env - 配置数据库连接信息:
PORT=3301
DB_HOST=localhost
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE=doodle_db
CORS_ORIGIN=http://localhost:3300
安装依赖
npm install
运行
开发模式
npm run start:dev
生产模式
npm run build
npm run start:prod
数据库迁移
项目使用 TypeORM 的 synchronize 选项(仅开发环境),生产环境应使用迁移。
API 接口
汉字管理
GET /words- 获取汉字列表(分页,每页9个)GET /words/:id- 获取汉字详情PATCH /words/:id- 更新汉字信息GET /words/:id/images- 获取汉字图片列表PATCH /words/:id/images/sort- 更新图片排序DELETE /words/:id/images/:imageId- 删除图片GET /words/:id/sentences- 获取汉字句子列表POST /words/:id/sentences- 添加句子DELETE /words/:id/sentences/:sentenceId- 删除句子
注意事项
- 汉字、拼音、SVG数据通过其他方式导入,不支持在后台新建
- 图片最多支持4张
- 列表按年级升序排序(低年级在前)