move api to /api/*
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"maps"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"slices"
|
||||
"sort"
|
||||
"strconv"
|
||||
@@ -64,9 +65,9 @@ func main() {
|
||||
like = append(like, ledger.LikeAfter(*likeAfter))
|
||||
|
||||
foo := func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.URL.Path {
|
||||
case "/bal", "/reg":
|
||||
case "/ui":
|
||||
switch path.Dir(r.URL.Path) {
|
||||
case "/api":
|
||||
case "/":
|
||||
f, err := os.Open("./index.html")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -281,9 +282,9 @@ func main() {
|
||||
}
|
||||
return chart
|
||||
}
|
||||
primary := toChart(r.URL.Path == "/bal", r.URL.Query().Get("chart"), register)
|
||||
primary := toChart(r.URL.Path == "/api/bal", r.URL.Query().Get("chart"), register)
|
||||
if len(predicted) > 0 {
|
||||
primary.Overlap(toChart(r.URL.Path == "/bal", "line", predicted))
|
||||
primary.Overlap(toChart(r.URL.Path == "/api/bal", "line", predicted))
|
||||
}
|
||||
if err := primary.Render(w); err != nil {
|
||||
panic(err)
|
||||
|
||||
Reference in New Issue
Block a user