🎉 init: 小龙的工作空间
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
# NoteApp — Backend API
|
||||
|
||||
> 一款支持多端同步、Markdown 编辑和标签管理的笔记应用。
|
||||
|
||||
## 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
|
||||
#### 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
|
||||
|
||||
#### stock_in
|
||||
- `GET /api/stock_in` — List all
|
||||
- `GET /api/stock_in/:id` — Get by ID
|
||||
- `POST /api/stock_in` — Create
|
||||
- `PUT /api/stock_in/:id` — Update
|
||||
- `DELETE /api/stock_in/:id` — Delete
|
||||
|
||||
#### stock_out
|
||||
- `GET /api/stock_out` — List all
|
||||
- `GET /api/stock_out/:id` — Get by ID
|
||||
- `POST /api/stock_out` — Create
|
||||
- `PUT /api/stock_out/:id` — Update
|
||||
- `DELETE /api/stock_out/:id` — Delete
|
||||
|
||||
#### stocktaking
|
||||
- `GET /api/stocktaking` — List all
|
||||
- `GET /api/stocktaking/:id` — Get by ID
|
||||
- `POST /api/stocktaking` — Create
|
||||
- `PUT /api/stocktaking/:id` — Update
|
||||
- `DELETE /api/stocktaking/:id` — Delete
|
||||
|
||||
#### stock_alerts
|
||||
- `GET /api/stock_alerts` — List all
|
||||
- `GET /api/stock_alerts/:id` — Get by ID
|
||||
- `POST /api/stock_alerts` — Create
|
||||
- `PUT /api/stock_alerts/:id` — Update
|
||||
- `DELETE /api/stock_alerts/:id` — Delete
|
||||
|
||||
#### warehouse
|
||||
- `GET /api/warehouse` — List all
|
||||
- `GET /api/warehouse/:id` — Get by ID
|
||||
- `POST /api/warehouse` — Create
|
||||
- `PUT /api/warehouse/:id` — Update
|
||||
- `DELETE /api/warehouse/:id` — Delete
|
||||
|
||||
### System
|
||||
- `GET /api/health` — Health check
|
||||
Reference in New Issue
Block a user