Add trading scores

This commit is contained in:
Nise Void 2018-06-11 12:59:14 +02:00
parent b0909c6f7e
commit ae1d9331ad
Signed by: NiseVoid
GPG key ID: FBA14AC83EA602F3
4 changed files with 229 additions and 0 deletions

View file

@ -40,6 +40,9 @@ func main() {
attrs = append(attrs, strings.ToLower(v.Name))
}
t := e.Group(`/trading`)
t.GET(`/:meter/scores`, getScores)
panic(e.Start(`localhost:33333`))
}
@ -72,3 +75,12 @@ func getAttr(index int) echo.HandlerFunc {
return c.JSON(200, app.GetAttribute(index, meter, date))
}
}
func getScores(c echo.Context) error {
meter, err := strconv.Atoi(c.Param(`meter`))
if err != nil {
return c.NoContent(400)
}
return c.JSON(200, app.GetScores(meter))
}