server

package
v0.0.0-...-77b0776 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyGraphQLCustomComplexityCalculation

func ApplyGraphQLCustomComplexityCalculation(config *generated.Config)

ApplyGraphQLCustomComplexityCalculation handles specific query complexity calculation. Complexity values: - Basic field: 1 - Field with extra sql queries: 1 + 3 per additional query - Paginated lists: multiply by number of item requested

func CreateUserRest

func CreateUserRest(w http.ResponseWriter, r *http.Request, repositories *repository.Container)

func DefineDirectives

func DefineDirectives(config *generated.Config, repositories *repository.Container)

DefineDirectives implements Graph directives

func HandleGraphQLServerError

func HandleGraphQLServerError(server *handler.Server)

HandleGraphQLServerError defines how graphql errors should be handled and logged.

func NewGraphQLServer

func NewGraphQLServer(config generated.Config, repositories *repository.Container) *handler.Server

NewGraphQLServer instanciates a new gqlgen server from a config and a logger.

func SetupGraphQLRoutes

func SetupGraphQLRoutes(

	repositories *repository.Container,
	servePlayground bool,
	server *handler.Server,
	router *mux.Router,
)

SetupGraphQLRoutes register HTTP handlers related to GraphQL/gqlgen.

Types

type ApiTemplateServer

type ApiTemplateServer struct {
	Router *mux.Router
	// contains filtered or unexported fields
}

ApiTemplateServer is the application entrypoint

func NewApiTemplateServer

func NewApiTemplateServer(configuration *Configuration) *ApiTemplateServer

NewApiTemplateServer create a server instance with a router

func (*ApiTemplateServer) Start

func (server *ApiTemplateServer) Start(ctx context.Context)

Start the server and wait for gracefull shutdown

type Configuration

type Configuration struct {
	Hostname        string
	Playground      bool
	Port            int
	HealthPort      string
	ShutdownTimeout time.Duration
}

Configuration provide options for HTTP server exposure.

func NewConfiguration

func NewConfiguration(v *viper.Viper) (configuration *Configuration, err error)

NewConfiguration is a factory function for creating a Configuration instance using a viper sub tree.

func (*Configuration) Addr

func (configuration *Configuration) Addr() string

Addr is a factory method for generating a server binding address.

Jump to

Keyboard shortcuts

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