move api to /api/*
parent
641ebf1c93
commit
4858286bd6
|
|
@ -17,12 +17,12 @@
|
|||
function callback(responseBody, responseStatus) {
|
||||
}
|
||||
function draw(form) {
|
||||
path = "/bal"
|
||||
path = "/api/bal"
|
||||
query = "?x=y"
|
||||
Array.from(form.elements).forEach((input) => {
|
||||
query += "&" + input.name + "=" + input.value;
|
||||
if (input.name == "mode") {
|
||||
path = "/" + input.value;
|
||||
path = "/api/" + input.value;
|
||||
}
|
||||
});
|
||||
console.log(path, query);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue