Skip to content

Instantly share code, notes, and snippets.

@bastianccm
Created February 26, 2020 13:12
Show Gist options
  • Save bastianccm/c5841e480568b6d805b034afbb9bedf1 to your computer and use it in GitHub Desktop.
Save bastianccm/c5841e480568b6d805b034afbb9bedf1 to your computer and use it in GitHub Desktop.
package polls
import "flamingo.me/flamingo/v3/framework/web"
type urls struct {
controller *controller
}
func (u *urls) Inject(controller *controller) {
u.controller = controller
}
func (u *urls) Routes(registry *web.RouterRegistry) {
registry.MustRoute("/", "index")
registry.HandleAny("index", u.controller.index)
registry.MustRoute("/:question_id", "detail")
registry.HandleAny("detail", u.controller.detail)
registry.MustRoute("/:question_id/results", "results")
registry.HandleAny("results", u.controller.results)
registry.MustRoute("/:question_id/vote", "vote")
registry.HandleAny("vote", u.controller.vote)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment