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

Side by Side Diff: go/src/infra/appengine/test-results/frontend/handlers.go

Issue 2251623002: test-results: Get handler cleanup (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@x_3
Patch Set: (Rebase) Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « go/src/infra/appengine/test-results/frontend/get_test.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package frontend 1 package frontend
2 2
3 import ( 3 import (
4 "html/template" 4 "html/template"
5 "net/http" 5 "net/http"
6 "time" 6 "time"
7 7
8 "google.golang.org/appengine" 8 "google.golang.org/appengine"
9 9
10 "github.com/luci/luci-go/appengine/gaemiddleware" 10 "github.com/luci/luci-go/appengine/gaemiddleware"
11 "github.com/luci/luci-go/server/router" 11 "github.com/luci/luci-go/server/router"
12 "github.com/luci/luci-go/server/templates" 12 "github.com/luci/luci-go/server/templates"
13 ) 13 )
14 14
15 func init() { 15 func init() {
16 r := router.New() 16 r := router.New()
17 baseMW := base() 17 baseMW := base()
18 18
19 » r.GET("/testfile", baseMW, GetHandler) 19 » r.GET("/testfile", baseMW, getHandler)
20 » r.GET("/testfile/", baseMW, GetHandler) 20 » r.GET("/testfile/", baseMW, getHandler)
21 21
22 http.DefaultServeMux.Handle("/", r) 22 http.DefaultServeMux.Handle("/", r)
23 } 23 }
24 24
25 // base returns the root middleware chain. 25 // base returns the root middleware chain.
26 func base() router.MiddlewareChain { 26 func base() router.MiddlewareChain {
27 templateBundle := &templates.Bundle{ 27 templateBundle := &templates.Bundle{
28 Loader: templates.FileSystemLoader("templates"), 28 Loader: templates.FileSystemLoader("templates"),
29 DebugMode: appengine.IsDevAppServer(), 29 DebugMode: appengine.IsDevAppServer(),
30 FuncMap: template.FuncMap{ 30 FuncMap: template.FuncMap{
31 "timeParams": func(t time.Time) string { 31 "timeParams": func(t time.Time) string {
32 return t.Format(paramsTimeFormat) 32 return t.Format(paramsTimeFormat)
33 }, 33 },
34 "timeJS": func(t time.Time) int64 { 34 "timeJS": func(t time.Time) int64 {
35 return t.Unix() * 1000 35 return t.Unix() * 1000
36 }, 36 },
37 }, 37 },
38 } 38 }
39 39
40 return gaemiddleware.BaseProd().Extend( 40 return gaemiddleware.BaseProd().Extend(
41 templates.WithTemplates(templateBundle), 41 templates.WithTemplates(templateBundle),
42 ) 42 )
43 } 43 }
OLDNEW
« no previous file with comments | « go/src/infra/appengine/test-results/frontend/get_test.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698