server

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDecoderOptions

func ConfigDecoderOptions(config *mapstructure.DecoderConfig)

ConfigDecoderOptions enables necessary mapstructure decode hook functions

func ErrToStatus

func ErrToStatus(err error) int

ErrToStatus gets the HTTP statuscode for an error

func JSONErrResponse

func JSONErrResponse(w http.ResponseWriter, err error, statusCode int)

JSONErrResponse Sends an `error` as a JSON object with a `message` property

func JSONResponse

func JSONResponse(w http.ResponseWriter, v interface{}, statusCode int)

JSONResponse Sends a JSON payload in response to a HTTP request

Types

type Config

type Config struct {
	LogLevel log.Level `mapstructure:"log_level"`

	HTTP struct {
		ListenAddress string `mapstructure:"listen_address"`
	}
}

Config defines octolxd's configuration

type Server

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

Server represents the octolxd server

func NewServer

func NewServer(config Config) *Server

NewServer creates a new octolxd server

func (*Server) Start

func (s *Server) Start() error

Start starts the octolxd server

func (*Server) Stop

func (s *Server) Stop() error

Stop shuts down the octolxd server

Jump to

Keyboard shortcuts

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