35 lines
654 B
Go
35 lines
654 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
"synlotto-website/handlers"
|
|
"synlotto-website/storage"
|
|
)
|
|
|
|
func main() {
|
|
db := storage.InitDB("synlotto.db")
|
|
|
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
|
switch r.URL.Path {
|
|
case "/":
|
|
handlers.Home(w, r)
|
|
case "/new":
|
|
handlers.NewDraw(w, r)
|
|
case "/submit":
|
|
handlers.Submit(w, r)
|
|
case "/ticket":
|
|
handlers.NewTicket(db)
|
|
case "/tickets":
|
|
handlers.ListTickets(db)
|
|
case "/submit-ticket":
|
|
handlers.SubmitTicket(db)
|
|
default:
|
|
http.NotFound(w, r)
|
|
}
|
|
})
|
|
|
|
log.Println("🌐 Running on http://localhost:8080")
|
|
log.Fatal(http.ListenAndServe(":8080", nil))
|
|
}
|