Gin-Gonic is a framework based on httprouter. We learned about httprouter in Chapter 2, Handling Routing for our REST Services. It is an HTTP multiplexer like gorilla/mux, but it is faster. Gin allows a high-level API to create REST services in a clean way.
Gin can be compared to another web framework in Go called Martini. All web frameworks allow us to do a lot more things such as templates and web server design, in addition to service creation.
One can install the Gin package using the following command:
go get gopkg.in/gin-gonic/gin.v1
Let's write a simple hello world program in Gin to get familiarized with the Gin constructs:
- First, create a file that holds our program:
touch -p $GOPATH/src/github.com/git-user/chapter4/ginExample/main.go ...