Use single API constructor

Individual constructors for each API version were removed in
GREsau/MailHog-Server@e7f979c845
This commit is contained in:
Graham Esau 2016-04-22 15:58:05 +02:00
parent 9976d0251c
commit 8dfadf408a

View file

@ -76,14 +76,12 @@ func main() {
if uiconf.UIBindAddr == apiconf.APIBindAddr { if uiconf.UIBindAddr == apiconf.APIBindAddr {
cb := func(r gohttp.Handler) { cb := func(r gohttp.Handler) {
web.CreateWeb(uiconf, r.(*pat.Router), assets.Asset) web.CreateWeb(uiconf, r.(*pat.Router), assets.Asset)
api.CreateAPIv1(apiconf, r.(*pat.Router)) api.CreateAPI(apiconf, r.(*pat.Router))
api.CreateAPIv2(apiconf, r.(*pat.Router))
} }
go http.Listen(uiconf.UIBindAddr, assets.Asset, exitCh, cb) go http.Listen(uiconf.UIBindAddr, assets.Asset, exitCh, cb)
} else { } else {
cb1 := func(r gohttp.Handler) { cb1 := func(r gohttp.Handler) {
api.CreateAPIv1(apiconf, r.(*pat.Router)) api.CreateAPI(apiconf, r.(*pat.Router))
api.CreateAPIv2(apiconf, r.(*pat.Router))
} }
cb2 := func(r gohttp.Handler) { cb2 := func(r gohttp.Handler) {
web.CreateWeb(uiconf, r.(*pat.Router), assets.Asset) web.CreateWeb(uiconf, r.(*pat.Router), assets.Asset)