diff options
Diffstat (limited to 'internal/handlers/main.go')
-rw-r--r-- | internal/handlers/main.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/internal/handlers/main.go b/internal/handlers/main.go index 3b551f1..74a66c7 100644 --- a/internal/handlers/main.go +++ b/internal/handlers/main.go @@ -1,10 +1,11 @@ package handlers import ( + "apjournal/config" + "html/template" "log/slog" "net/http" "os" - "apjournal/config" ) // Handlers structure @@ -34,3 +35,16 @@ func (h *Handlers) Ping(w http.ResponseWriter, r *http.Request) { h.log.Info("got ping request") w.Write([]byte("pong")) } + +func (h *Handlers) MainPage(w http.ResponseWriter, r *http.Request) { + h.log.Info("got mainpage request") + tmpl := template.Must(template. + ParseFiles("components/index.html")) + hardcodedName := "Guest" + tmpl.Execute(w, hardcodedName) +} + +func (h *Handlers) HandleForm(w http.ResponseWriter, r *http.Request) { + r.ParseForm() + h.log.Info("got postform request", "payload", r.PostForm) +} |