1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-01-10 00:29:01 +02:00
kratos/api/metadata/metadata_http.pb.go
Tony Chen b9f821c29f
transport/http: add http handler (#937)
* add http handler

* fix request error
2021-05-21 23:11:36 +08:00

37 lines
1.0 KiB
Go

// Code generated by protoc-gen-go-http. DO NOT EDIT.
package metadata
import (
context "context"
http1 "github.com/go-kratos/kratos/v2/transport/http"
binding "github.com/go-kratos/kratos/v2/transport/http/binding"
mux "github.com/gorilla/mux"
http "net/http"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the kratos package it is being compiled against.
var _ = new(http.Request)
var _ = new(context.Context)
var _ = binding.MapProto
var _ = mux.NewRouter
const _ = http1.SupportPackageIsVersion1
type MetadataHandler interface {
GetServiceDesc(context.Context, *GetServiceDescRequest) (*GetServiceDescReply, error)
ListServices(context.Context, *ListServicesRequest) (*ListServicesReply, error)
}
func NewMetadataHandler(srv MetadataHandler, opts ...http1.HandleOption) http.Handler {
r := mux.NewRouter()
r.Handle("/services", http1.NewHandler(srv.ListServices, opts...)).Methods("GET")
r.Handle("/services/{name}", http1.NewHandler(srv.GetServiceDesc, opts...)).Methods("GET")
return r
}