Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: start grpc server
Steven0dfc367e566f
diff --git a/api/v2/v2.go b/api/v2/v2.goindex 2ed08149c..e4a2f4374 100644--- a/api/v2/v2.go+++ b/api/v2/v2.go@@ -3,14 +3,18 @@ package v2import ("context""fmt"+ "net""github.com/grpc-ecosystem/grpc-gateway/v2/runtime""github.com/improbable-eng/grpc-web/go/grpcweb""github.com/labstack/echo/v4"+ "github.com/pkg/errors"+ "go.uber.org/zap""google.golang.org/grpc""google.golang.org/grpc/credentials/insecure""google.golang.org/grpc/reflection"+ "github.com/usememos/memos/internal/log"apiv2pb "github.com/usememos/memos/proto/gen/api/v2""github.com/usememos/memos/server/profile""github.com/usememos/memos/store"@@ -127,5 +131,16 @@ func (s *APIV2Service) RegisterGateway(ctx context.Context, e *echo.Echo) errorwrappedGrpc := grpcweb.WrapServer(s.grpcServer, options...)e.Any("/memos.api.v2.*", echo.WrapHandler(wrappedGrpc))+ // Start gRPC server.+ listen, err := net.Listen("tcp", fmt.Sprintf("%s:%d", s.Profile.Addr, s.grpcServerPort))+ if err != nil {+ return errors.Wrap(err, "failed to start gRPC server")+ }+ go func() {+ if err := s.grpcServer.Serve(listen); err != nil {+ log.Error("grpc server listen error", zap.Error(err))+ }+ }()+return nil}