- Go Lang
- Postgres
curl -X GET http://localhost:8080/ping
{
"error": "Internal server error."
}
curl -X GET http://localhost:8080/books
{
"books": [
{
"id": "1",
"title": "To Kill a Mockingbird",
"price": 10.99,
"publishedDate": "1960-07-11"
},
{
"id": "2",
"title": "The Great Gatsby",
"price": 15.99,
"publishedDate": "1925-04-10"
}
]
}
curl -X POST http://localhost:8080/books \
-H 'Content-Type: application/json' \
-d '{
"title": "The Great Gatsby",
"price": 15.99,
"publishedDate": "1925-04-10"
}'
{
"id": "101",
"title": "The Great Gatsby",
"price": 15.99,
"publishedDate": "1925-04-10",
"message": "Book successfully added to the library."
}
curl -X GET http://localhost:8080/books/1
{
"id": "1",
"title": "To Kill a Mockingbird",
"price": 10.99,
"publishedDate": "1960-07-11"
}
curl -X PUT http://localhost:8080/books/1 \
-H 'Content-Type: application/json' \
-d '{
"title": "Updated Book Title"
}'
{
"id": "1",
"title": "Updated Book Title",
"message": "Book title successfully updated."
}
curl -X DELETE http://localhost:8080/books/1
{
"id": "1",
"message": "Book successfully deleted."
}