Basic example for creating middlewares in Beego framework.
Standard go get:
$ go get github.com/ojardila/beego_middleware
go get github.com/astaxie/beego
Add the following lines into the routers/routers.go file which will initialize the filter to run on all requests (BeforeStatic, BeforeRouter, BeforeStatic, AfterExec and FinishRouter)
import "github.com/ojardila/beego_middleware"
func init() {
beego_keenio.InitMiddleware()
}