// NewHTTPServer new a HTTP server.
NewHTTPServer new a HTTP server.
// NewHTTPServer new a HTTP server .
func NewHTTPServer(c *conf.Server, service *service.SweetService, logger log.Logger) *http.Server {
	_metricHistogramSeconds,_metricRequests,_metricGaugeSeconds := NewMetrics(c)
	var opts = []http.ServerOption{
		http.Middleware(
			middlewares.Auth(),
			recovery.Recovery(),
			metrics.Server(
				metrics.WithSeconds("_metricHistogramSeconds",prom.NewHistogram(_metricHistogramSeconds)),
				metrics.WithRequests("_metricRequests",prom.NewCounter(_metricRequests)),
				metrics.WithApiSeconds("_metricHistogramSeconds",prom.NewGauge(_metricGaugeSeconds)),
			),
		),
		http.Filter(
			filter.CorsFilter,
		),
	}
	if c.Http.Network != "" {
		opts = append(opts, http.Network(c.Http.Network))
	}
	if c.Http.Addr != "" {
		opts = append(opts, http.Address(c.Http.Addr))
	}
	if c.Http.Timeout != nil {
		opts = append(opts, http.Timeout(c.Http.Timeout.AsDuration()))
	}
	srv := http.NewServer(opts...)
	NewSwaggerServer(c,srv)
	TracerProvider("http://127.0.0.1:14268/api/traces")
	srv.Handle("/metrics", promhttp.Handler())
	v1.RegisterSweetHTTPServer(srv, service)
	return srv
}
func NewHTTPServer ( c * conf . Server , service * service . SweetService , logger log . Logger ) * http . Server { _metricHistogramSeconds , _metricRequests , _metricGaugeSeconds := NewMetrics ( c ) var opts = [ ] http . ServerOption { http . Middleware ( middlewares . Auth ( ) , recovery . Recovery ( ) , metrics . Server ( metrics . WithSeconds ( " " , prom . NewHistogram ( _metricHistogramSeconds ) ) , metrics . WithRequests ( " " , prom . NewCounter ( _metricRequests ) ) , metrics . WithApiSeconds ( " " , prom . NewGauge ( _metricGaugeSeconds ) ) , ) , ) , http . Filter ( filter . CorsFilter , ) , } if c . Http . Network != " " { opts = append ( opts , http . Network ( c . Http . Network ) ) } if c . Http . Addr != " " { opts = append ( opts , http . Address ( c . Http . Addr ) ) } if c . Http . Timeout != nil { opts = append ( opts , http . Timeout ( c . Http . Timeout . AsDuration ( ) ) ) } srv := http . NewServer ( opts ... ) NewSwaggerServer ( c , srv ) TracerProvider ( " " ) srv . Handle ( " " , promhttp . Handler ( ) ) v1 . RegisterSweetHTTPServer ( srv , service ) return srv }
NewHTTPServer new a HTTP server.
NewHTTPServer new a HTTP server .