Skip to content

Commit

Permalink
docs: http calls example (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzoh authored Jan 17, 2025
1 parent 1cb11d9 commit 0b4944a
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion api_examples.http
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
@api-endpoint=http://localhost:3000

### Get all todos from api
GET http://localhost:3000/todos
GET {{api-endpoint}}/todos
Accept: application/json

### Get one todo by id
GET {{api-endpoint}}/todos?id=eq.1
Accept: application/vnd.pgrst.object+json

### Get one todo by with categorie
GET {{api-endpoint}}/todos?select=*,categories(*)
Accept: application/vnd.pgrst.object+json

### Add a todo
POST {{api-endpoint}}/todos
Content-Type: application/json

{
"title": "My todo",
"due_date": "2025-02-10"
}

### Add a categorie
POST {{api-endpoint}}/categories
Content-Type: application/json

{
"title": "personal",
"color": "#e74c3c"
}

### Link a categorie to a todo
POST {{api-endpoint}}/categories_todos
Content-Type: application/json

{
"todo_id": 1,
"categorie_id": 1
}

0 comments on commit 0b4944a

Please sign in to comment.