Basic CRUD Restful API with Golang

Go Language

this api does a simple CRUD operations on a single table mysql Database .

this is build on top off gin framwork and GORM library

link to GORM!
link to gin!

the api use different HTTP methods ( GET, POST, PUT, and DELETE )

to make this work correctly you need to :

  • you need to clone gin and gorm
  • you need to have mysql installed in your machine ( install xampp if you don't have )
  • create a new empty database and call it 'api-go'

to add the gin framwork (copy and past this into ur terminal)

go get "https://github.com/gin-gonic/gin"

to add the GORM library (copy and past this into ur terminal)

go get "https://github.com/go-gorm/gorm"

Listening and serving HTTP on :8888

  • GET /v1/api/book/:id --> get single book
  • GET /v1/api/books --> get all books
  • POST /v1api/book --> create new book
  • PUT /v1api/book/:id --> update book
  • DELETE /v1api/book/:id --> delete book

Thank you..~