51 lines
1.3 KiB
Markdown
51 lines
1.3 KiB
Markdown
# Simple Todo API (Monolith)
|
|
|
|
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 ./cmd/server
|
|
```
|
|
|
|
The server listens on `:8080`.
|
|
|
|
## Frontend
|
|
|
|
```bash
|
|
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/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' \
|
|
-H 'Content-Type: application/json' \
|
|
-d '{"title":"Learn Gin","priority":1,"tags":["demo"]}'
|
|
|
|
curl http://localhost:8080/api/v1/tasks \
|
|
-H 'Authorization: Bearer demo'
|
|
```
|
|
|
|
## Notes
|
|
- 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).
|