I have started developing web application where the back end is Go. I'm using beego framework to develop this application.Previously i used to program in java. Java has a filter function to filter the request by url. I came to know that we can implement it in beego after reading the documentation. There they have given the following example code
var FilterUser = func(ctx *context.Context) {
    if strings.HasPrefix(ctx.Input.URL(), "/login") {
        return
    }
    _, ok := ctx.Input.Session("uid").(int)
    if !ok {
        ctx.Redirect(302, "/login")
    }
}
beego.InsertFilter("/*", beego.BeforeRouter, FilterUser) 
The problem is I don't know where to use this block of code.