Code zu Hinzufügen eines Teilnehmers hinzugefügt

This commit is contained in:
Jason Streifling 2023-10-04 18:55:48 +02:00
parent 32fbd1d28d
commit 48f104650f

View File

@ -29,9 +29,14 @@ type Briefing struct {
func main() { func main() {
mux := http.NewServeMux() mux := http.NewServeMux()
mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static/"))))
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
template.Must(template.ParseFiles("templates/index.html")).Execute(w, nil) template.Must(template.ParseFiles("templates/index.html")).Execute(w, nil)
}) })
mux.HandleFunc("/add-participant/", func(w http.ResponseWriter, r *http.Request) {
template.Must(template.ParseFiles("templates/index.html", "templates/participant.html")).ExecuteTemplate(w, "participant", nil)
})
log.Fatalln(http.ListenAndServe(":8080", mux)) log.Fatalln(http.ListenAndServe(":8080", mux))
} }