comparison pkg/controllers/routes.go @ 2762:f95ec0bb565c

Added endpoint to deliver average waterlevels for a given gauge. GET /api/data/average-waterlevels/{GAUGE}?from={FROM}&to={TO} from and to are optional and defaults to end of today and going a year backwards. Output is CSV in form of #date,#min,#max,#mean,#median,#Q25,#Q75
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 21 Mar 2019 18:07:49 +0100
parents 87aed4f9b1b8
children db1052bc162a
comparison
equal deleted inserted replaced
2761:71e7237110ba 2762:f95ec0bb565c
300 // Handler to serve data to the client. 300 // Handler to serve data to the client.
301 301
302 api.Handle("/data/waterlevels/{gauge}", any( 302 api.Handle("/data/waterlevels/{gauge}", any(
303 middleware.DBConn(http.HandlerFunc(waterlevels)))).Methods(http.MethodGet) 303 middleware.DBConn(http.HandlerFunc(waterlevels)))).Methods(http.MethodGet)
304 304
305 api.Handle("/data/average-waterlevels/{gauge}", any(
306 middleware.DBConn(http.HandlerFunc(averageWaterlevels)))).Methods(http.MethodGet)
307
305 api.Handle("/data/nash-sutcliffe/{gauge}", any(&JSONHandler{ 308 api.Handle("/data/nash-sutcliffe/{gauge}", any(&JSONHandler{
306 Handle: nashSutcliffe, 309 Handle: nashSutcliffe,
307 })).Methods(http.MethodGet) 310 })).Methods(http.MethodGet)
308 311
309 // Token handling: Login/Logout. 312 // Token handling: Login/Logout.