Example #1
0
func (s *Server) globalHandler(ctx *tango.Context) {
	param := ctx.Param("*name")
	if param == "favicon.ico" || param == "robots.txt" {
		if !s.serveFiles(ctx, param) {
			ctx.NotFound()
		}
		return
	}

	if !strings.HasPrefix("/"+param, s.prefix) {
		ctx.Redirect(s.prefix)
		return
	}
	param = strings.TrimPrefix("/"+param, s.prefix)
	s.serveFiles(ctx, param)
}