43 lines
901 B
Go

package main
import (
"html/template"
"log"
"net/http"
)
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
}
func main() {
mux := http.NewServeMux()
mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static/"))))
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
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))
}