2023-10-04 17:13:03 +02:00
|
|
|
package main
|
|
|
|
|
2023-10-04 17:29:22 +02:00
|
|
|
import (
|
|
|
|
"html/template"
|
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
2023-10-04 17:41:22 +02:00
|
|
|
type Person struct {
|
|
|
|
FirstName string
|
|
|
|
LastName string
|
|
|
|
}
|
|
|
|
|
|
|
|
type Instructor Person
|
|
|
|
|
|
|
|
type Participant struct {
|
|
|
|
Person
|
|
|
|
Company string
|
|
|
|
}
|
|
|
|
|
|
|
|
type Briefing struct {
|
|
|
|
Instructor
|
|
|
|
Date string
|
|
|
|
Time string
|
|
|
|
State string
|
|
|
|
Location string
|
|
|
|
Participants []Participant
|
|
|
|
}
|
|
|
|
|
2023-10-04 17:29:22 +02:00
|
|
|
func main() {
|
|
|
|
mux := http.NewServeMux()
|
2023-10-04 18:55:48 +02:00
|
|
|
|
|
|
|
mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static/"))))
|
2023-10-04 17:29:22 +02:00
|
|
|
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
template.Must(template.ParseFiles("templates/index.html")).Execute(w, nil)
|
|
|
|
})
|
2023-10-04 18:55:48 +02:00
|
|
|
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)
|
|
|
|
})
|
2023-10-04 17:29:22 +02:00
|
|
|
|
|
|
|
log.Fatalln(http.ListenAndServe(":8080", mux))
|
|
|
|
}
|