Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to support part of the pathinfo #325

Open
ghost opened this issue Nov 16, 2020 · 1 comment
Open

How to support part of the pathinfo #325

ghost opened this issue Nov 16, 2020 · 1 comment

Comments

@ghost
Copy link

ghost commented Nov 16, 2020

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

@Fov6363
Copy link
Contributor

Fov6363 commented Jan 17, 2022

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-"):])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant