go-siris / siris

DEPRECATED: The community driven fork of Iris. The fastest web framework for Golang!
Other
142 stars 16 forks source link

Added Many to router API Builder #27

Closed Allendar closed 7 years ago

Allendar commented 7 years ago

Use

app.Many("/login", []string{"GET", "POST"}, routeLogin)

instead of

app.Get("/login", routeLogin)
app.Post("/login", routeLogin)
Allendar commented 7 years ago

Maybe it would be prettier to allow the native constants?

app.Many("/login", []int{http.MethodGet, http.MethodPost}, routeLogin)
Dexus commented 7 years ago

@godofdream API change? V8? @Allendar Thanks for your PR, I like it. I think, the native constants are better here. But on the other hand... the "shortnames" would also be nice... let @godofdream give a feedback.

godofdream commented 7 years ago

@Dexus We did not break compatibility yet, so still API V7. @Allendar Thanks for your PR. Nice work! The []string{"GET", "POST"} Method is easier for beginners (I prefer this solution). The speed improvement by using []int{http.MethodGet, http.MethodPost} is only feelable if someone adds routes all the time and not only during initialization. If we want to go with []int{http.MethodGet, http.MethodPost} we should change the whole api for all route operations, which seems not useful for now.