Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: appengine/cmd/milo/frontend/milo.go

Issue 2043423004: Make HTTP middleware easier to use (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: gaemiddleware: add middleware func for WithProd Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/cmd/milo/buildbot/pubsub_test.go ('k') | appengine/cmd/milo/settings/settings.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/cmd/milo/frontend/milo.go
diff --git a/appengine/cmd/milo/frontend/milo.go b/appengine/cmd/milo/frontend/milo.go
index a231cde1107badb6839a2654cd609dfffc484467..ac0b405d15b065d3f51a250c286699cb07c984de 100644
--- a/appengine/cmd/milo/frontend/milo.go
+++ b/appengine/cmd/milo/frontend/milo.go
@@ -1,44 +1,39 @@
// Copyright 2015 The LUCI Authors. All rights reserved.
// Use of this source code is governed under the Apache License, Version 2.0
// that can be found in the LICENSE file.
package frontend
import (
"net/http"
- "github.com/julienschmidt/httprouter"
-
"github.com/luci/luci-go/appengine/cmd/milo/buildbot"
"github.com/luci/luci-go/appengine/cmd/milo/settings"
"github.com/luci/luci-go/appengine/cmd/milo/swarming"
"github.com/luci/luci-go/appengine/gaemiddleware"
+ "github.com/luci/luci-go/server/router"
)
// Where it all begins!!!
func init() {
// Register plain ol' http services.
- r := httprouter.New()
- gaemiddleware.InstallHandlers(r, settings.Base)
- r.GET("/", wrap(frontpage{}))
- r.GET("/swarming/:server/:id/steps/*logname", wrap(swarming.Log{}))
- r.GET("/swarming/:server/:id", wrap(swarming.Build{}))
+ r := router.New()
+ basemw := settings.Base()
+ gaemiddleware.InstallHandlers(r, basemw)
+ r.GET("/", basemw, settings.Wrap(frontpage{}))
+ r.GET("/swarming/:server/:id/steps/*logname", basemw, settings.Wrap(swarming.Log{}))
+ r.GET("/swarming/:server/:id", basemw, settings.Wrap(swarming.Build{}))
// Buildbot
- r.GET("/buildbot/:master/:builder/:build", wrap(buildbot.Build{}))
- r.GET("/buildbot/:master/:builder/", wrap(buildbot.Builder{}))
+ r.GET("/buildbot/:master/:builder/:build", basemw, settings.Wrap(buildbot.Build{}))
+ r.GET("/buildbot/:master/:builder/", basemw, settings.Wrap(buildbot.Builder{}))
// User settings
- r.GET("/settings", wrap(settings.Settings{}))
- r.POST("/settings", settings.Base(settings.ChangeSettings))
+ r.GET("/settings", basemw, settings.Wrap(settings.Settings{}))
+ r.POST("/settings", basemw, settings.ChangeSettings)
// PubSub subscription endpoints.
- r.POST("/pubsub/buildbot", settings.Base(buildbot.PubSubHandler))
+ r.POST("/pubsub/buildbot", basemw, buildbot.PubSubHandler)
http.Handle("/", r)
}
-
-// Do all the middleware initilization and theme handling.
-func wrap(h settings.ThemedHandler) httprouter.Handle {
- return settings.Wrap(h)
-}
« no previous file with comments | « appengine/cmd/milo/buildbot/pubsub_test.go ('k') | appengine/cmd/milo/settings/settings.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698