package main import ( "log" "net/http" "github.com/dalu/gopiwik/mongo" "github.com/dalu/gopiwik/piwik" "gopkg.in/mgo.v2" ) const ( database = "piwik" siteCol = "sites" visitCol = "visits" ) func main() { ms, e := mgo.Dial("localhost") if e != nil { log.Fatal(e) } defer ms.Close() siteStorage := mongo.NewSiteStorage(ms, database, siteCol) visitStorage := mongo.NewVisitStorage(ms, database, visitCol) ph := piwik.NewPiwikHandler(siteStorage, visitStorage) http.Handle("/", ph) http.ListenAndServe(":8080", nil) }