示例#1
0
func main() {

	gocbcore.SetLogger(gocbcore.DefaultStdOutLogger())

	cluster, _ := gocb.Connect("couchbase://52.17.36.153")
	bucket, _ := cluster.OpenBucket("ryanair", "")

	router := router.NewRouter(bucket)
	log.Fatal(http.ListenAndServe(":8080", router))
}
func main() {
	gocbcore.SetLogger(gocbcore.DefaultStdOutLogger())
	runtime.GOMAXPROCS(runtime.NumCPU())
	cluster, _ = gocb.Connect("http://172.31.31.191")
	bucket, _ = cluster.OpenBucket("default", "")
	bucket.Upsert("test", 0, 100)
	bucket.Upsert("total_votes", 0, 0)
	ch = make(chan Event, 1000)
	time.AfterFunc(1*time.Second, func() {
		for i := 1; i < 72; i++ {
			fmt.Println("starting worker %d", i)
			go worker(ch)
		}
	})
	http.HandleFunc("/vote", voteHandler)
	http.HandleFunc("/loaderio-35df9c4fffde902e3b0e3e0115816d82.html", validationHandler)
	http.ListenAndServe(":80", nil)
}