🎉 init: 小龙的工作空间
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
# MyProject — 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
|
||||
#### contracts
|
||||
- `GET /api/contracts` — List all
|
||||
- `GET /api/contracts/:id` — Get by ID
|
||||
- `POST /api/contracts` — Create
|
||||
- `PUT /api/contracts/:id` — Update
|
||||
- `DELETE /api/contracts/:id` — Delete
|
||||
|
||||
#### approvals
|
||||
- `GET /api/approvals` — List all
|
||||
- `GET /api/approvals/:id` — Get by ID
|
||||
- `POST /api/approvals` — Create
|
||||
- `PUT /api/approvals/:id` — Update
|
||||
- `DELETE /api/approvals/:id` — Delete
|
||||
|
||||
#### customers
|
||||
- `GET /api/customers` — List all
|
||||
- `GET /api/customers/:id` — Get by ID
|
||||
- `POST /api/customers` — Create
|
||||
- `PUT /api/customers/:id` — Update
|
||||
- `DELETE /api/customers/:id` — Delete
|
||||
|
||||
#### reminders
|
||||
- `GET /api/reminders` — List all
|
||||
- `GET /api/reminders/:id` — Get by ID
|
||||
- `POST /api/reminders` — Create
|
||||
- `PUT /api/reminders/:id` — Update
|
||||
- `DELETE /api/reminders/:id` — Delete
|
||||
|
||||
#### assets
|
||||
- `GET /api/assets` — List all
|
||||
- `GET /api/assets/:id` — Get by ID
|
||||
- `POST /api/assets` — Create
|
||||
- `PUT /api/assets/:id` — Update
|
||||
- `DELETE /api/assets/:id` — Delete
|
||||
|
||||
#### items
|
||||
- `GET /api/items` — List all
|
||||
- `GET /api/items/:id` — Get by ID
|
||||
- `POST /api/items` — Create
|
||||
- `PUT /api/items/:id` — Update
|
||||
- `DELETE /api/items/:id` — Delete
|
||||
|
||||
#### stats
|
||||
- `GET /api/stats` — List all
|
||||
- `GET /api/stats/:id` — Get by ID
|
||||
- `POST /api/stats` — Create
|
||||
- `PUT /api/stats/:id` — Update
|
||||
- `DELETE /api/stats/:id` — Delete
|
||||
|
||||
### System
|
||||
- `GET /api/health` — Health check
|
||||
Reference in New Issue
Block a user