Пример #1
0
func main() {
	api.MapRoutes()

	address := ":" + os.Getenv("PORT")
	server := &http.Server{
		Addr:           address,
		Handler:        goweb.DefaultHttpHandler(),
		ReadTimeout:    10 * time.Second,
		WriteTimeout:   10 * time.Second,
		MaxHeaderBytes: 1 << 20,
	}

	listener, listenErr := net.Listen("tcp", address)
	if listenErr != nil {
		panic(listenErr)
	}

	server.Serve(listener)
}
Пример #2
0
func init() {
	api.MapRoutes()
	http.Handle("/", goweb.DefaultHttpHandler())
}