29 lines
400 B
Go
29 lines
400 B
Go
|
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)
|
||
|
}
|