Gin Web Framework

Gin is a web framework written in Go (Golang). It features a martini-like API with performance that is up to 40 times faster thanks to httprouter. If you need performance and good productivity, you will love Gin.

Installing and configuring Gin

gorilla/mux Middleware

gorilla/mux: Create a new router object

create a router using the Gorilla mux package. This is accomplished via the following code:

r := mux.NewRouter()
eventsrouter := r.PathPrefix("/events").Subrouter()

The preceding code makes use of the router object we created earlier, then calls the PathPrefix method, which is used to capture any URL path that starts with /events. Then, finally, we call the Subrouter() method, which will create a new router object for us to use from now on to handle any incoming requests to URLs that start with /events. The new router is called eventsrouter.

gorilla/mux Middleware

Obtain the gorilla/mux package

Use of the go get command in order to obtain the package to our development environment:

$ go get
import the mux package 
Middleware My Go Tutorial