summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/main.go b/main.go
index 84dcd6e..29c85da 100644
--- a/main.go
+++ b/main.go
@@ -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)