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

Option to specify regex as path to match a request #7

Open
rousan opened this issue May 3, 2020 · 1 comment
Open

Option to specify regex as path to match a request #7

rousan opened this issue May 3, 2020 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@rousan
Copy link
Member

rousan commented May 3, 2020

An example:

let r = Router::builder()
              .get_re("^/users/(\d+)$", handler)

Then if it matches, the captured matches can be extracted from req as req.captures().

let r = Router::builder()
              .get_re(r"^/users/(\d+)$", |req| async move {
                   let user_id = req.captures("0");
              })
@rousan
Copy link
Member Author

rousan commented May 3, 2020

Reference: https://github.com/kardeiz/reset-router

@gsserge gsserge added the help wanted Extra attention is needed label Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants