mmg/main.go

28 lines
650 B
Go
Raw Normal View History

2013-05-08 22:43:18 -07:00
package main
import (
"flag"
"github.com/gorilla/sessions"
"log"
"net/http"
"math/rand"
"time"
2013-05-08 22:43:18 -07:00
)
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("hello world"))
func main() {
rand.Seed( time.Now().UTC().UnixNano())
2013-05-08 22:43:18 -07:00
flag.Parse()
http.Handle("/",
http.FileServer(http.Dir(*static_files)))
2013-05-08 22:57:52 -07:00
http.HandleFunc("/api/v0/attempt/", attempt)
http.HandleFunc("/api/v0/problem/", problem)
2013-05-08 22:43:18 -07:00
if err := http.ListenAndServe(*addr, nil); err != nil {
log.Fatal("ListenAndServe:", err)
}
}