更新
This commit is contained in:
@@ -16,6 +16,11 @@ func AutoRegisterHandler(ctx context.Context, mux *runtime.ServeMux, opts ...grp
|
||||
return err
|
||||
}
|
||||
|
||||
err = service.RegisterNotifyHandlerClientNacos(ctx, mux, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = service.RegisterInfoHandlerClientNacos(ctx, mux, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
|
||||
"fusen-basic/env"
|
||||
"fusen-gateway/gen/go/service"
|
||||
@@ -27,12 +28,20 @@ func main() {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
mux := runtime.NewServeMux(
|
||||
runtime.WithErrorHandler(func(ctx context.Context, sm *runtime.ServeMux, m runtime.Marshaler, w http.ResponseWriter, r *http.Request, err error) {
|
||||
log.Println(err)
|
||||
w.Write([]byte("\n" + err.Error()))
|
||||
}),
|
||||
runtime.WithMetadata(logic.PassMetadata),
|
||||
runtime.WithForwardResponseOption(logic.ResponseHeaderMatcher),
|
||||
runtime.WithMarshalerOption("*", &logic.EmptyMarshaler{}),
|
||||
)
|
||||
|
||||
opts := []grpc.DialOption{
|
||||
grpc.WithUnaryInterceptor(func(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
|
||||
log.Println(method)
|
||||
return invoker(ctx, method, req, reply, cc, opts...)
|
||||
}),
|
||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user