package main import ( "flag" "log" "math/rand" "net/http" "os" "time" "github.com/gorilla/sessions" ) const MAX = 12 var addr = flag.String("addr", ":8000", "address I'll listen on.") var static_files = flag.String("static", "./static", "location of static files") var store = sessions.NewCookieStore([]byte(os.Getenv("MMG_SECRET_KEY"))) func main() { rand.Seed(time.Now().UTC().UnixNano()) flag.Parse() http.Handle("/", http.FileServer(http.Dir(*static_files))) http.HandleFunc("/api/v0/addsub/problem/", addsub) http.HandleFunc("/api/v0/mul/problem/", mul) http.HandleFunc("/api/v0/attempt/", attempt) if err := http.ListenAndServe(*addr, nil); err != nil { log.Fatal("ListenAndServe:", err) } }