|
|
|
@ -5,7 +5,6 @@ import ( |
|
|
|
|
"github.com/go-kratos/kratos/examples/blog/internal/conf" |
|
|
|
|
"github.com/go-kratos/kratos/examples/blog/internal/service" |
|
|
|
|
"github.com/go-kratos/kratos/v2/log" |
|
|
|
|
"github.com/go-kratos/kratos/v2/middleware" |
|
|
|
|
"github.com/go-kratos/kratos/v2/middleware/logging" |
|
|
|
|
"github.com/go-kratos/kratos/v2/middleware/recovery" |
|
|
|
|
"github.com/go-kratos/kratos/v2/middleware/tracing" |
|
|
|
@ -26,11 +25,9 @@ func NewHTTPServer(c *conf.Server, tracer trace.TracerProvider, blog *service.Bl |
|
|
|
|
opts = append(opts, http.Timeout(c.Http.Timeout.AsDuration())) |
|
|
|
|
} |
|
|
|
|
m := http.Middleware( |
|
|
|
|
middleware.Chain( |
|
|
|
|
tracing.Server(tracing.WithTracerProvider(tracer)), |
|
|
|
|
logging.Server(log.DefaultLogger), |
|
|
|
|
recovery.Recovery(), |
|
|
|
|
), |
|
|
|
|
tracing.Server(tracing.WithTracerProvider(tracer)), |
|
|
|
|
logging.Server(log.DefaultLogger), |
|
|
|
|
recovery.Recovery(), |
|
|
|
|
) |
|
|
|
|
srv := http.NewServer(opts...) |
|
|
|
|
srv.HandlePrefix("/", v1.NewBlogServiceHandler(blog, m)) |
|
|
|
|