December 2017
Intermediate to advanced
316 pages
6h 58m
English
Strict Slash is a parameter on the Mux router by which we can order the router to redirect URL routes with trailing slashes to those without them. For example, /articles/ can be the original path, but routes coming with /path will be redirected to the original path:
r := mux.NewRouter() r.StrictSlash(true)r.Path("/articles/").Handler(ArticleHandler)
This URL redirects to the preceding ArticleHandler if the StrictSlash parameter is set to true:
http://localhost:8000/articles