server

package
v0.0.0-...-18f9ab3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	gen.UnimplementedUserActionServer
	GWServer *http.Server
}

func SetupGrpc

func SetupGrpc() *Server

func (*Server) Close

func (s *Server) Close(ctx context.Context) error

startup and run grpc-gateway server

func (*Server) DeleteUser

func (s *Server) DeleteUser(ctx context.Context, in *gen.UserIdentifier) (*emptypb.Empty, error)

DeleteUser deletes a user curl localhost:8090/user/delete/1 -X DELETE

func (*Server) GetUserInfo

func (s *Server) GetUserInfo(ctx context.Context, in *gen.UserIdentifier) (*gen.User, error)

GetUserInfo gets a user curl localhost:8090/user/getinfo/1

func (*Server) RunGrpc

func (s *Server) RunGrpc(ctx context.Context, port string) error

startup and run grpc server

func (*Server) SendUserAction

func (s *Server) SendUserAction(ctx context.Context, in *gen.Action) (*emptypb.Empty, error)

SendUserAction sends a user action curl localhost:8090/user/action -X -d '{"action": 1, "userId": 1}'

func (*Server) SetupGateway

func (s *Server) SetupGateway(ctx context.Context, port string, grpcPort string) error

SetupGateway creates the Rest server via grpc connection/

func (*Server) UpdateUser

func (s *Server) UpdateUser(ctx context.Context, in *gen.User) (*emptypb.Empty, error)

UpdateUser updates a user curl localhost:8090/user -X -d '{"id": 1, "name": "SoyPete", "email": "captainnobody1@gmail", "password": "password"}'

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL