--
You received this message because you are subscribed to the Google Groups "Gorilla web toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gorilla-web...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gorilla-web/fa89852e-b293-419c-bc3d-fe177dc05ed1o%40googlegroups.com.
Now let's see how to build registered URLs.
Routes can be named. All routes that define a name can have their URLs built, or "reversed". We define a name calling Name() on a route. For example:
r := mux.NewRouter() r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler). Name("article")
To build a URL, get the route and call the URL() method, passing a sequence of key/value pairs for the route variables. For the previous route, we would do:
url, err := r.Get("article").URL("category", "technology", "id", "42")
...and the result will be a url.URL with the following path:
"/articles/technology/42"
Could you expand on this? Not sure what you mean?
On Sat, Jun 13, 2020 at 3:34 AM Farhad Kocharli <kocharl...@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "Gorilla web toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to goril...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to gorilla-web...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gorilla-web/592185e3-812d-414f-a2f6-8ea5b7379590o%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gorilla-web/592185e3-812d-414f-a2f6-8ea5b7379590o%40googlegroups.com.