server

package
v1.0.0-rc.17 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package server handles the GraphQL HTTP server.

Index

Constants

This section is empty.

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 ReadTreatments

func ReadTreatments(p string) httprouter.Handle

TODO sercure these endpoints

func WriteTreatments

func WriteTreatments(p string) httprouter.Handle

Types

type Config

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

	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