зеркало из https://github.com/Azure/buffalo-azure.git
Adding Registration helper. (#20)
* Adding Registration helper. * Fixing formatting
This commit is contained in:
Родитель
402c1c9f9f
Коммит
79debb4daf
|
@ -0,0 +1,21 @@
|
|||
package eventgrid
|
||||
|
||||
import (
|
||||
"github.com/gobuffalo/buffalo"
|
||||
)
|
||||
|
||||
// RegisterSubscriber updates a `buffalo.App` to route requests to a particular
|
||||
// subscriber.
|
||||
// This method is the spiritual equivalent of `App.Resource`:
|
||||
// https://godoc.org/github.com/gobuffalo/buffalo#App.Resource
|
||||
func RegisterSubscriber(app *buffalo.App, route string, s Subscriber) *buffalo.App {
|
||||
group := app.Group(route)
|
||||
|
||||
route = "/"
|
||||
|
||||
group.POST(route, SubscriptionValidationMiddleware(s.Receive))
|
||||
group.GET(route, s.List)
|
||||
group.GET(route+"{event_id}", s.Show)
|
||||
|
||||
return group
|
||||
}
|
Загрузка…
Ссылка в новой задаче