Skip to content

Commit

Permalink
Merge pull request #15 from huerni/feat/gmctl
Browse files Browse the repository at this point in the history
feat(gmctl): update main
  • Loading branch information
huerni committed Aug 19, 2023
2 parents 0243994 + e9d2e4b commit 6976345
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion gmctl/generator/tpl/server/cmd/main.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ package main

import (
"context"
"google.golang.org/grpc"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/huerni/gmitex/pkg/http/handlers"
"github.com/huerni/gmitex/pkg/http/response"
"google.golang.org/grpc"
"google.golang.org/protobuf/encoding/protojson"
{{.imports}}
)

Expand All @@ -17,6 +21,18 @@ func main() {
srv := handler.New{{.serverName}}Server(ctx)
{{.mserverName}}.Register{{.serverName}}Server(server, srv)
})

g.HttpServer.AddMuxOp(
runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.HTTPBodyMarshaler{
Marshaler: &response.CustomMarshaler{
M: &runtime.JSONPb{
MarshalOptions: protojson.MarshalOptions{},
UnmarshalOptions: protojson.UnmarshalOptions{},
}}}),
runtime.WithErrorHandler(handlers.ErrorHandler),
)


g.Start(context.Background())
g.WaitForShutdown(context.Background())
}

0 comments on commit 6976345

Please sign in to comment.