diff options
Diffstat (limited to '')
-rw-r--r-- | main.go | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -64,6 +64,8 @@ func main() { // handlers that required authentification authMux.Handle("GET /{$}", indexPage()) + authMux.Handle("GET /recur/{$}", recurPage()) + authMux.Handle("GET /categories/{$}", categoriesPage()) authMux.Handle("GET /", notfound()) log.Fatal(http.ListenAndServe(os.Getenv("GOSTEN_ADDRESS"), handler)) @@ -83,6 +85,22 @@ func indexPage() http.HandlerFunc { } } +func recurPage() http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + uid := userId(r) + exps, _ := Q.GetRecurExpenses(r.Context(), uid) + showTemplate(w, "recur", exps) + } +} + +func categoriesPage() http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + uid := userId(r) + cats, _ := Q.GetCategories(r.Context(), uid) + showTemplate(w, "categories", cats) + } +} + func notfound() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { showTemplate(w, "404", r.RequestURI) |