package main import ( "court/handlers" "court/utils" "fmt" "log" "net/http" ) func main() { port := utils.Getenv("COURT_PORT", "8080") address := utils.Getenv("COURT_ADDR", "0.0.0.0") handlers.BaseURL = utils.Getenv("COURT_URL", "https://court.local/") err := handlers.SetupDB() if err != nil { log.Panic(err) } defer handlers.DB.Close() http.HandleFunc("GET /webui", handlers.Webui) http.HandleFunc("GET /{id}", handlers.Redirect) http.HandleFunc("DELETE /{id}", handlers.Delete) http.HandleFunc("POST /", handlers.Post) listen_addr := fmt.Sprintf("%s:%s", address, port) fmt.Printf("\nListening on address: %s\n", listen_addr) http.ListenAndServe(listen_addr, nil) }