Component
Core framework
Middleware
n/a
Is your feature request related to a problem? Please describe
To register a route for multiple HTTP methods, one would use follows:
f.Routes("/", "GET,POST", ...)
However, the use of "GET,POST"
looks very non-elegant, and one always needs to type in full characters without editor's auto-completion (because this is literal string).
Describe the solution you'd like
The net/http
package provides constants for each HTTP method, e.g. http.MethodGet
, we should be able to do things more elegant like:
f.Routes("/", http.MethodGet, http.MethodPost, <my handlers>)
Because these constants are strings after all, the router should be able to distinguished them from handlers, and magically do the trick for users.
Describe alternatives you've considered
n/a
Additional context
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
🎯 feature 🔆 roadmap