latest
This commit is contained in:
34
internal/handlers/signup.go
Normal file
34
internal/handlers/signup.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"git.eeqj.de/sneak/gohttpserver/templates"
|
||||
)
|
||||
|
||||
func (s *Handlers) HandleSignupGET() http.HandlerFunc {
|
||||
t := templates.GetParsed()
|
||||
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
err := t.ExecuteTemplate(w, "signup.html", nil)
|
||||
if err != nil {
|
||||
s.log.Error().Err(err).Msg("")
|
||||
http.Error(w, http.StatusText(500), 500)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Handlers) HandleSignupPOST() http.HandlerFunc {
|
||||
t := templates.GetParsed()
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
_ = r.ParseForm()
|
||||
|
||||
err := t.ExecuteTemplate(w, "signup.html", nil)
|
||||
|
||||
if err != nil {
|
||||
s.log.Error().Err(err).Msg("")
|
||||
http.Error(w, http.StatusText(500), 500)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user