to run the api server
cd cmd
and
go run .
example curl request
curl --request POST \
--url http://localhost:8000/contact \
--header 'Content-Type: application/json' \ \
--data '{
"name": "John Doe 3",
"email": "[email protected]"
}
'
response
{
"ID": 6,
"name": "John Doe 3",
"email": "[email protected]",
"Tasks": null
}
example curl request
curl --request GET \
--url http://localhost:8000/contact/6 \
--header 'Content-Type: application/json' \
response
{
"ID": 6,
"name": "John Doe 3",
"email": "[email protected]",
"Tasks": null
}
example curl request
curl --request POST \
--url http://localhost:8000/task \
--header 'Content-Type: application/json' \
--data '{
"title": "Task 3",
"description": "Complete task 3",
"reminder": "2024-01-18T12:00:00Z",
"contact_id": 6
}
'
response
{
"ID": 5,
"title": "Task 3",
"description": "Complete task 3",
"reminder": "2024-01-18T12:00:00Z",
"contact_id": 6
}
example curl request
curl --request GET \
--url http://localhost:8000/contact \
--header 'Content-Type: application/json' \
response
[
{
"ID": 1,
"name": "John Doe",
"email": "[email protected]",
"Tasks": null
}
]