cmd

package
v0.0.0-...-7bc3701 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2020 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Port string
)
View Source
var RootCmd = &cobra.Command{
	Version: "1.0.0",
	Use:     "gomather",
	Short:   "Simple Go gRPC microservice that does math.",
}
View Source
var StartCmd = &cobra.Command{
	Use:   "start",
	Short: "Starts the server",
	Run: func(command *cobra.Command, args []string) {
		listener, err := net.Listen("tcp", Port)
		if err != nil {
			log.Fatal("Server could not listen", rz.Err(err))
		}

		server := grpc.NewServer()

		reflection.Register(server)
		math.RegisterMathServer(server, &svc.Math{})
		log.Info("Server started on port", rz.String("port", Port))

		if err := server.Serve(listener); err != nil {
			log.Fatal("Server could not start", rz.Err(err))
		}
	},
}

Functions

func Execute

func Execute()

Types

This section is empty.

Jump to

Keyboard shortcuts

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