예제 #1
0
func standUpServer() error {
	srv := &http.Server{Addr: hostport}

	reg, router, cxt := cookoo.Cookoo()

	buildRegistry(reg, router, cxt)

	// Our main datasource is the Medium, which manages channels.
	m := pubsub.NewMedium()
	cxt.AddDatasource(pubsub.MediumDS, m)
	cxt.Put("routes", reg.Routes())

	http2.ConfigureServer(srv, &http2.Server{})

	srv.Handler = web.NewCookooHandler(reg, router, cxt)

	srv.ListenAndServeTLS("../server/server.crt", "../server/server.key")
	return nil
}
예제 #2
0
func main() {
	srv := &http.Server{
		Addr: ":5500",
	}

	reg, router, cxt := cookoo.Cookoo()

	buildRegistry(reg, router, cxt)

	// Our main datasource is the Medium, which manages channels.
	m := pubsub.NewMedium()
	cxt.AddDatasource(pubsub.MediumDS, m)
	cxt.Put("routes", reg.Routes())

	http2.ConfigureServer(srv, &http2.Server{})

	srv.Handler = web.NewCookooHandler(reg, router, cxt)

	srv.ListenAndServeTLS("server.crt", "server.key")
}