chore: update project files

This commit is contained in:
2026-02-13 23:23:36 +08:00
parent 66e438978e
commit 6a2d2c9724
1361 changed files with 4298 additions and 5117 deletions

View File

@@ -1,29 +1,38 @@
# Simple Todo API (Demo)
# Simple Todo API (Monolith)
This is a minimal, runnable RESTful API aligned with the plan. It uses Gin and an in-memory store.
This project is a single backend service built with Gin.
The `iam/` directory is kept as a separate scaffold module and is not part of the monolith build.
## Run
```bash
go run ./main.go
go run ./cmd/server
```
The server listens on `:8080`.
## Frontend
The UI is served from local files under `test/web` at `/`:
```bash
open http://localhost:8080/api
cd vue
npm install
npm run dev
```
The Vue app calls `http://localhost:8080/api/v1` by default.
## Quick Demo
```bash
curl http://localhost:8080/api/health
curl -X POST http://localhost:8080/api/v1/auth/login
curl -X POST http://localhost:8080/api/v1/auth/register \
-H 'Content-Type: application/json' \
-d '{"email":"demo@example.com","password":"secret123"}'
curl -X POST http://localhost:8080/api/v1/auth/login \
-H 'Content-Type: application/json' \
-d '{"email":"demo@example.com","password":"secret123"}'
curl -X POST http://localhost:8080/api/v1/tasks \
-H 'Authorization: Bearer demo' \
@@ -35,5 +44,7 @@ curl http://localhost:8080/api/v1/tasks \
```
## Notes
- Data is in-memory only; restart will clear it.
- Auth is a placeholder; any non-empty `Authorization` header is accepted.
- Tasks and users are stored in PostgreSQL.
- Auth uses HMAC-signed bearer tokens with TTL (default 24h).
- Redis token cache is optional (`REDIS_ADDR` not set means disabled).
- Kafka task event emit is optional (`KAFKA_BROKERS` not set means disabled).