| Index: appengine/cmd/helloworld_mvm/backend/main.go
|
| diff --git a/appengine/cmd/helloworld_mvm/backend/main.go b/appengine/cmd/helloworld_mvm/backend/main.go
|
| index 23e62c89f6ed29985ff19d978aad7e5ddbdc5219..a5d840df4c57a50a8744e07de8ae8196da76a11a 100644
|
| --- a/appengine/cmd/helloworld_mvm/backend/main.go
|
| +++ b/appengine/cmd/helloworld_mvm/backend/main.go
|
| @@ -2,39 +2,34 @@
|
| // Use of this source code is governed under the Apache License, Version 2.0
|
| // that can be found in the LICENSE file.
|
|
|
| // Package main implements HTTP server that handles requests to backend
|
| // module.
|
| package main
|
|
|
| import (
|
| "net/http"
|
|
|
| - "github.com/julienschmidt/httprouter"
|
| - "golang.org/x/net/context"
|
| "google.golang.org/appengine"
|
|
|
| "github.com/luci/luci-go/appengine/gaemiddleware"
|
| - "github.com/luci/luci-go/server/middleware"
|
| + "github.com/luci/luci-go/server/router"
|
| )
|
|
|
| -// base is the root of the middleware chain.
|
| -func base(h middleware.Handler) httprouter.Handle {
|
| - return gaemiddleware.BaseProd(h)
|
| -}
|
| -
|
| //// Routes.
|
|
|
| func main() {
|
| - router := httprouter.New()
|
| - gaemiddleware.InstallHandlers(router, base)
|
| - router.GET("/hi", base(sayHi))
|
| - http.DefaultServeMux.Handle("/", router)
|
| + r := router.New()
|
| + basemw := gaemiddleware.BaseProd()
|
| +
|
| + gaemiddleware.InstallHandlers(r, basemw)
|
| + r.GET("/hi", basemw, sayHi)
|
| + http.DefaultServeMux.Handle("/", r)
|
|
|
| appengine.Main()
|
| }
|
|
|
| //// Handlers.
|
|
|
| -func sayHi(c context.Context, w http.ResponseWriter, r *http.Request, p httprouter.Params) {
|
| - w.Write([]byte("Hi, I'm backend"))
|
| +func sayHi(c *router.Context) {
|
| + c.Writer.Write([]byte("Hi, I'm backend"))
|
| }
|
|
|