Exemplo n.º 1
0
func main() {
	database = db.Connect()
	defer database.Close()

	ws := gotalk.WebSocketHandler()
	ws.OnAccept = onAccept

	wwwPath := "./www"
	if envWWWPath := os.Getenv("WWW_PATH"); envWWWPath != "" {
		wwwPath = envWWWPath
	}

	listenAddr := ":7654"
	if envListenAddr := os.Getenv("WWW_PATH"); envListenAddr != "" {
		listenAddr = envListenAddr
	}

	http.Handle("/gotalk/", ws)
	http.Handle("/", http.FileServer(http.Dir(wwwPath)))
	panic(http.ListenAndServe(listenAddr, nil))
}
Exemplo n.º 2
0
package person

import "github.com/dustywilson/dingbat/db"

var database = db.Connect()
var coll = database.C("person")