29 lines
640 B
Go
Raw Normal View History

2023-10-05 18:08:44 +02:00
package main
2023-10-04 17:13:03 +02:00
2023-10-04 17:29:22 +02:00
import (
"log"
"net/http"
2023-10-05 18:08:44 +02:00
"streifling.com/jason/sicherheitsunterweisung/db"
"streifling.com/jason/sicherheitsunterweisung/server"
2023-10-04 17:29:22 +02:00
)
func main() {
var i, j int64
2023-10-05 18:08:44 +02:00
var b server.Briefing
i, j = 1, 1
mux := http.NewServeMux()
2023-10-05 18:08:44 +02:00
_, err := db.OpenDB("sicherheitsunterweisung")
if err != nil {
log.Fatalln(err)
}
mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static/"))))
2023-10-05 18:08:44 +02:00
mux.HandleFunc("/", server.DisplayForm(i))
mux.HandleFunc("/add-participant/", server.AddParticipant(i))
mux.HandleFunc("/submit/", server.SubmitForm(b, i, j))
2023-10-04 17:29:22 +02:00
log.Fatalln(http.ListenAndServe(":8080", mux))
}