- Install dependencies:
bun install- Copy environment file:
cp .env.example .env-
Edit
.envwith your PostgreSQL and Redis credentials -
Run the server:
bun run startGET /swagger- Interactive API documentationGET /todos- List all todosPOST /todos- Create todo:{"title": "Buy milk", "completed": false}PUT /todos/:id- Update todo:{"title": "Buy milk", "completed": true}DELETE /todos/:id- Delete todo
GET /redis/test- Test Redis connectionGET /redis/:key- Get value by keyPOST /redis- Set key-value:{"key":"mykey","value":"myvalue","ttl":60}(ttl optional)DELETE /redis/:key- Delete key
curl http://localhost:3000/todos
curl -X POST http://localhost:3000/todos -H "Content-Type: application/json" -d '{"title":"Test todo"}'Build and run:
docker build -t todo-api .
docker run -p 3000:3000 --env-file .env todo-api