🎉 init: 小龙的工作空间
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
# EduPlatform — Backend API
|
||||
|
||||
> 一个支持在线课程学习、直播授课、题库练习和学情追踪的教育平台。
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- **Runtime**: Node.js
|
||||
- **Framework**: Fastify 5
|
||||
- **Language**: TypeScript
|
||||
- **Database**: SQLite (better-sqlite3)
|
||||
- **Auth**: JWT + bcrypt
|
||||
|
||||
## Getting Started
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
npm install
|
||||
|
||||
# Development (hot reload)
|
||||
npm run dev
|
||||
|
||||
# Build
|
||||
npm run build
|
||||
|
||||
# Production start
|
||||
npm run start
|
||||
|
||||
# Run tests
|
||||
npm test
|
||||
```
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
src/
|
||||
├── index.ts # Server entry point
|
||||
├── db/
|
||||
│ ├── schema.ts # SQLite schema
|
||||
│ └── client.ts # Database client
|
||||
├── routes/
|
||||
│ ├── auth.ts # Auth routes (register/login/me)
|
||||
│ └── *.ts # CRUD routes
|
||||
├── services/
|
||||
│ └── *.ts # Business logic
|
||||
├── middleware/
|
||||
│ └── auth.ts # JWT middleware
|
||||
├── types/
|
||||
│ └── index.ts # TypeScript types
|
||||
└── __tests__/
|
||||
└── *.test.ts # Tests
|
||||
```
|
||||
|
||||
## API Endpoints
|
||||
|
||||
### Auth
|
||||
- `POST /api/auth/register` — Register
|
||||
- `POST /api/auth/login` — Login
|
||||
- `GET /api/auth/me` — Current user (auth required)
|
||||
|
||||
### Resources
|
||||
#### courses
|
||||
- `GET /api/courses` — List all
|
||||
- `GET /api/courses/:id` — Get by ID
|
||||
- `POST /api/courses` — Create
|
||||
- `PUT /api/courses/:id` — Update
|
||||
- `DELETE /api/courses/:id` — Delete
|
||||
|
||||
#### chapters
|
||||
- `GET /api/chapters` — List all
|
||||
- `GET /api/chapters/:id` — Get by ID
|
||||
- `POST /api/chapters` — Create
|
||||
- `PUT /api/chapters/:id` — Update
|
||||
- `DELETE /api/chapters/:id` — Delete
|
||||
|
||||
#### students
|
||||
- `GET /api/students` — List all
|
||||
- `GET /api/students/:id` — Get by ID
|
||||
- `POST /api/students` — Create
|
||||
- `PUT /api/students/:id` — Update
|
||||
- `DELETE /api/students/:id` — Delete
|
||||
|
||||
#### assignments
|
||||
- `GET /api/assignments` — List all
|
||||
- `GET /api/assignments/:id` — Get by ID
|
||||
- `POST /api/assignments` — Create
|
||||
- `PUT /api/assignments/:id` — Update
|
||||
- `DELETE /api/assignments/:id` — Delete
|
||||
|
||||
### System
|
||||
- `GET /api/health` — Health check
|
||||
Reference in New Issue
Block a user