github.com/web-platform-tests/wpt.fyi@v0.0.0-20240530210107-70cf978996f1/webapp/web/main.go (about) 1 package main 2 3 import ( 4 "context" 5 6 "github.com/samthor/nicehttp" 7 8 "github.com/web-platform-tests/wpt.fyi/api" 9 "github.com/web-platform-tests/wpt.fyi/api/azure" 10 "github.com/web-platform-tests/wpt.fyi/api/checks" 11 "github.com/web-platform-tests/wpt.fyi/api/query" 12 "github.com/web-platform-tests/wpt.fyi/api/receiver" 13 "github.com/web-platform-tests/wpt.fyi/api/screenshot" 14 "github.com/web-platform-tests/wpt.fyi/api/taskcluster" 15 "github.com/web-platform-tests/wpt.fyi/shared" 16 "github.com/web-platform-tests/wpt.fyi/webapp" 17 ) 18 19 func init() { 20 // webapp.RegisterRoutes has a catch-all, so needs to go last. 21 api.RegisterRoutes() 22 azure.RegisterRoutes() 23 checks.RegisterRoutes() 24 query.RegisterRoutes() 25 receiver.RegisterRoutes() 26 screenshot.RegisterRoutes() 27 taskcluster.RegisterRoutes() 28 webapp.RegisterRoutes() 29 } 30 31 func main() { 32 if err := shared.Clients.Init(context.Background()); err != nil { 33 shared.Clients.Close() 34 panic(err) 35 } 36 defer shared.Clients.Close() 37 38 // This behaves differently in prod and locally: 39 // * Prod: the provided app.yaml is not used; it simply starts the 40 // DefaultServerMux on $PORT (defaults to 8080). 41 // * Local: in addition to the prod behaviour, it also starts some 42 // static handlers according to app.yaml, which effectively replaces 43 // dev_appserver.py. 44 nicehttp.Serve("webapp/web/app.staging.yaml", nil) 45 }