30 lines
753 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"
"streifling.com/jason/sicherheitsunterweisung/packages/db"
"streifling.com/jason/sicherheitsunterweisung/packages/server"
2023-10-04 17:29:22 +02:00
)
func main() {
var i, j int64
i, j = 1, 1
mux := http.NewServeMux()
db, err := db.Open("sicherheitsunterweisung")
if err != nil {
log.Fatalln(err)
}
mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static/"))))
mux.HandleFunc("/", server.DisplayTable(db))
mux.HandleFunc("/submit/", server.SubmitForm(db, &i, &j))
mux.HandleFunc("/search/", server.DisplayResults(db))
mux.HandleFunc("/new-briefing/", server.DisplayForm(&i))
mux.HandleFunc("/add-participant/", server.AddParticipant(&i))
2023-10-04 17:29:22 +02:00
log.Fatalln(http.ListenAndServe(":8080", mux))
}