server

package
v1.11.2 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package server handles the GraphQL HTTP server.

Index

Constants

View Source
const DefaultAddr = ":3000"

Variables

This section is empty.

Functions

func ConfigFlags

func ConfigFlags(cmd *cobra.Command, prefix string) error

ConfigFlags helps configure cobra and viper flags.

func DevCheck

func DevCheck(isProd bool) httprouter.Handle

func Enable

func Enable(
	ctx context.Context,
	config *Config,
	router *httprouter.Router,
) error

func ReadLobbies

func ReadLobbies(p string) httprouter.Handle

TODO sercure these endpoints

func ReadTreatments

func ReadTreatments(p string) httprouter.Handle

TODO sercure these endpoints

func WriteLobbies

func WriteLobbies(p string) httprouter.Handle

func WriteTreatments

func WriteTreatments(p string) httprouter.Handle

Types

type Config

type Config struct {
	Addr       string `mapstructure:"addr"`
	Treatments string `mapstructure:"treatments"`
	Lobbies    string `mapstructure:"lobbies"`

	// Player frontend proxy
	ProxyAddr string `mapstructure:"proxyaddr"`

	Production bool `mapstructure:"-"`
}

Config is server configuration.

func (*Config) Validate

func (c *Config) Validate() error

Validate configuration is ok.

type Server

type Server struct {
	Router *httprouter.Router
	// contains filtered or unexported fields
}

Server holds the server state.

func Prepare

func Prepare(config *Config) (*Server, error)

Prepare prepares the HTTP server.

func Start

func Start(
	ctx context.Context,
	config *Config,
) (*Server, error)

Start creates and starts the GraphQL HTTP server.

func (*Server) Start

func (s *Server) Start(ctx context.Context) (err error)

Start creates and starts the GraphQL HTTP server.

func (*Server) Wait

func (s *Server) Wait()

Wait for the server to close.

Jump to

Keyboard shortcuts

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