commit aeba88e67eec07f946cbf562b710d3d900ce0c7d
parent b5febcad8bd1771f646b2bf756e6111a632904b6
Author: Chris Bracken <chris@bracken.jp>
Date: Fri, 12 Nov 2021 23:28:18 -0800
Minor cleanup to HTTP handler order
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/http/http.go b/http/http.go
@@ -29,13 +29,17 @@ func CreateServer(ds storage.DataStore) *HttpServer {
func (s HttpServer) ListenAndServe(addr string) error {
mux := goji.NewMux()
+
+ // API endpoints.
mux.HandleFunc(pat.Post("/sensor/airrohr/"), s.PostAirrohr)
mux.HandleFunc(pat.Get("/sensor/reading/:sensorId/:readingType"), s.QueryReadings)
mux.HandleFunc(pat.Get("/sensor/sensors/"), s.QuerySensors)
- mux.HandleFunc(pat.Get("/dashboard/"), s.PresentDashboard)
+ // UI endpoints.
fs := http.FileServer(http.Dir(staticResourceDir))
mux.Handle(pat.Get("/static/*"), http.StripPrefix("/static", fs))
+ mux.HandleFunc(pat.Get("/dashboard/"), s.PresentDashboard)
+
return http.ListenAndServe(addr, mux)
}