Sample project to validate the GORM lib as database layer
This project implements a book library with five operations:
- POST /books (Insert a new book on the library)
- GET /books/{bookID} (Get a book by your ID on the library)
- PUT /books/{bookID} (Update a book on the library)
- DELETE /books/{bookID} (Delete a book on the library)
- GET /books (Get all books on the library)
To build the database you have to run the SQL migration on your local MySQL database:
To up the application only use the following Go command:
go run .
To validate if all up ok send an HTTP GET to /ping
route and expect a text pong
:
curl http://localhost:8080/ping