I have a validator function to check if a given path matches a path in array of paths.
Current Logic:
var allowed := String{"/users", "/teams"}
func Validator(path String) bool {
for _, p := range allowed {
if path == p {
return true
}
}
return false
}
I want to replace this using golang gorilla mux because I might have path variables. mux's github repo says "HTTP router and URL matcher". however, there aren't examples on how to use it for URL matching.