mirror of
https://github.com/System-End/haxmas-day-4.git
synced 2026-04-19 15:18:22 +00:00
docs for api routes :pf
This commit is contained in:
parent
76e4790142
commit
b4ae3e0588
1 changed files with 61 additions and 0 deletions
61
README.md
61
README.md
|
|
@ -9,3 +9,64 @@ bun run dev
|
|||
```
|
||||
|
||||
open http://localhost:3000
|
||||
|
||||
## Endpoints
|
||||
|
||||
### Get all items
|
||||
```
|
||||
GET /api/wishlist
|
||||
```
|
||||
|
||||
### Add an item
|
||||
```
|
||||
POST /api/wishlist
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
**Body:**
|
||||
```json
|
||||
{
|
||||
"item": "Nintendo Switch",
|
||||
"link": "https://amazon.com/...",
|
||||
"price": 29999,
|
||||
"priority": 1,
|
||||
"category": "gaming",
|
||||
"notes": "OLED version please!"
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Type | Required |
|
||||
|-------|------|----------|
|
||||
| `item` | string | ✅ |
|
||||
| `link` | string | ❌ |
|
||||
| `price` | number | ❌ |
|
||||
| `priority` | number | ❌ |
|
||||
| `category` | string | ❌ |
|
||||
| `notes` | string | ❌ |
|
||||
|
||||
### Claim an item
|
||||
```
|
||||
PATCH /api/wishlist/:id/claim
|
||||
```
|
||||
|
||||
### Delete an item
|
||||
```
|
||||
DELETE /api/wishlist/:id
|
||||
```
|
||||
|
||||
## Quick Examples
|
||||
|
||||
```bash
|
||||
# Add item
|
||||
curl -X POST http://localhost:3000/api/wishlist \
|
||||
-H "content-type: application/json" \
|
||||
-d '{"item":"PS5", "category":"gaming", "priority":1}'
|
||||
|
||||
# List all
|
||||
curl http://localhost:3000/api/wishlist
|
||||
|
||||
# Claim item 1
|
||||
curl -X PATCH http://localhost:3000/api/wishlist/1/claim
|
||||
|
||||
# Delete item 1
|
||||
curl -X DELETE http://localhost:3000/api/wishlist/1
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue