julienschmidt/httprouter

How to support part of the pathinfo

netroby opened this issue · 1 comments

For example, we want to rewrite /forum-{:id}.html to match the id from the part of the url.

i don't know how to do it.

:id was the named params.

if id = 4

request may like /forum-4.html

For reference: Spring framework has PathPattern very powerful

you can use /forum-:id, but not through ps.ByName("id") get id, you can self parse id, like

id, err := strconv.Atoi("/forml-4"[len("/forml-"):])