voce/main.go

29 lines
400 B
Go
Raw Permalink Normal View History

2015-09-24 18:42:56 +02:00
package main
import (
"log"
"net/http"
"gopkg.in/mgo.v2"
"github.com/dalu/voce/handler"
)
func main() {
ms, e := mgo.Dial("localhost")
if e != nil {
log.Fatalln(e.Error())
}
defer ms.Close()
ph := &handler.PostHandler{
MS: ms.Clone(),
DB: "voce",
C: "posten",
}
defer ph.MS.Close()
http.Handle("/post/", http.StripPrefix("/post/", ph))
http.ListenAndServe(":8080", nil)
}