server

package
v0.1.41 Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: Apache-2.0 Imports: 23 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadEnv added in v0.1.41

func LoadEnv(envPath ...string) error

LoadEnv loads environment variables from .env file.

func LoadEnvFromString added in v0.1.41

func LoadEnvFromString(env string) error

Types

type Config added in v0.1.39

type Config struct {
	CorsConfig         *cors.Cors
	UnaryInterceptors  []grpc.UnaryServerInterceptor
	StreamInterceptors []grpc.StreamServerInterceptor

	// Additional http handlers. All of the gRpc APIs will be exposed by default on http Rest for web.
	ExtraHttpHandlers map[string]func(http.ResponseWriter, *http.Request)
}

func NewConfig added in v0.1.39

func NewConfig(options ...Option) *Config

type GoApiBoot

type GoApiBoot struct {
	GrpcServer *grpc.Server
	WebServer  *http.Server
}

func NewGoApiBoot

func NewGoApiBoot(options ...Option) *GoApiBoot

func (*GoApiBoot) Start

func (g *GoApiBoot) Start(grpcPort, webPort string)

func (*GoApiBoot) Stop added in v0.1.31

func (g *GoApiBoot) Stop()

type Option added in v0.1.39

type Option func(*Config)

func AppendHttpHandlers added in v0.1.39

func AppendHttpHandlers(handlers map[string]func(http.ResponseWriter, *http.Request)) Option

func AppendStreamInterceptors added in v0.1.39

func AppendStreamInterceptors(interceptors []grpc.StreamServerInterceptor) Option

func AppendUnaryInterceptors added in v0.1.39

func AppendUnaryInterceptors(interceptors []grpc.UnaryServerInterceptor) Option

func WithCorsConfig added in v0.1.39

func WithCorsConfig(corsConfig *cors.Cors) Option

type WebProxy added in v0.1.34

type WebProxy struct {
	// contains filtered or unexported fields
}

func GetWebProxy added in v0.1.34

func GetWebProxy(server *grpc.Server) WebProxy

func (WebProxy) ServeHTTP added in v0.1.34

func (w WebProxy) ServeHTTP(resp http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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