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

✨ feature: route constraints #1998

Merged
merged 17 commits into from Aug 16, 2022

Conversation

efectn
Copy link
Member

@efectn efectn commented Aug 6, 2022

Close: #1903

Example:

app.Get("/:test<min(5)>", func(c *fiber.Ctx) error {
	return c.SendString(c.Params("test"))
})

app.Get("/:test<int;min(5)>", func(c *fiber.Ctx) error {
	return c.SendString(c.Params("test"))
})

To-Do:

  • Tests and benchmarks.
  • Multiple constraints.
  • Add customization for regex matching.
  • Performance checks.

@efectn efectn linked an issue Aug 6, 2022 that may be closed by this pull request
}
}

return err == nil
Copy link
Member Author

@efectn efectn Aug 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we skip or return false when consantraint not found?

path_test.go Show resolved Hide resolved
@efectn efectn marked this pull request as ready for review August 7, 2022 15:45
path.go Outdated Show resolved Hide resolved
@ReneWerner87 ReneWerner87 added the v2 label Aug 8, 2022
utils/regex.go Outdated Show resolved Hide resolved
router.go Outdated Show resolved Hide resolved
app.go Outdated Show resolved Hide resolved
path.go Outdated Show resolved Hide resolved
router.go Outdated Show resolved Hide resolved
path.go Outdated Show resolved Hide resolved
path.go Outdated Show resolved Hide resolved
Copy link
Member

@ReneWerner87 ReneWerner87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add more benchmark tests, so we can keep an eye on the most important thing -> the performance

path.go Outdated Show resolved Hide resolved
@ReneWerner87 ReneWerner87 merged commit 2517944 into gofiber:master Aug 16, 2022
@efectn efectn deleted the feature/route-constraints branch August 16, 2022 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🚀 Request: Route Constraints
3 participants