ad better function handling
This commit is contained in:
19
main.go
19
main.go
@@ -7,9 +7,22 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
http.HandleFunc("/", handlers.Home)
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
http.HandleFunc("/new", handlers.NewDraw)
|
switch r.URL.Path {
|
||||||
http.HandleFunc("/submit", handlers.Submit)
|
case "/":
|
||||||
|
handlers.Home(w, r)
|
||||||
|
case "/new":
|
||||||
|
handlers.NewDraw(w, r)
|
||||||
|
case "/submit":
|
||||||
|
handlers.Submit(w, r)
|
||||||
|
case "/ticket":
|
||||||
|
handlers.NewTicket(w, r)
|
||||||
|
case "/submit-ticket":
|
||||||
|
handlers.SubmitTicket(w, r)
|
||||||
|
default:
|
||||||
|
http.NotFound(w, r)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
log.Println("🚀 Lotto Tracker running on http://localhost:8080")
|
log.Println("🚀 Lotto Tracker running on http://localhost:8080")
|
||||||
log.Fatal(http.ListenAndServe(":8080", nil))
|
log.Fatal(http.ListenAndServe(":8080", nil))
|
||||||
|
|||||||
Reference in New Issue
Block a user