Rename NewAPI to RegisterAPI
This commit is contained in:
parent
7933d0edba
commit
98fe623d60
2
api.go
2
api.go
|
@ -35,7 +35,7 @@ type API struct {
|
||||||
context func(r *http.Request) context.Context
|
context func(r *http.Request) context.Context
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAPI(r *route.Router, alerts provider.Alerts, silences provider.Silences) *API {
|
func RegisterAPI(r *route.Router, alerts provider.Alerts, silences provider.Silences) *API {
|
||||||
api := &API{
|
api := &API{
|
||||||
context: route.Context,
|
context: route.Context,
|
||||||
alerts: alerts,
|
alerts: alerts,
|
||||||
|
|
2
main.go
2
main.go
|
@ -126,7 +126,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
router := route.New()
|
router := route.New()
|
||||||
NewAPI(router.WithPrefix("/api/v1"), alerts, silences)
|
RegisterAPI(router.WithPrefix("/api/v1"), alerts, silences)
|
||||||
|
|
||||||
go http.ListenAndServe(*listenAddress, router)
|
go http.ListenAndServe(*listenAddress, router)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue