server

package
v0.0.0-...-f9f6c77 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorHandler

func ErrorHandler(w http.ResponseWriter, r *http.Request, code int, errors ...string)

ErrorHandler for errors. Use code = -1 to bypass writing header or trying to set Content-Type. Useful when headers are already sent.

func Start

func Start(ctx context.Context, params Params) error

Start server.

Types

type DNSRequest

type DNSRequest struct {
	X   json.Number `json:"x" example:"32.1"`
	Y   json.Number `json:"y" example:"4.2"`
	Z   json.Number `json:"z" example:"31.3"`
	Vel json.Number `json:"vel" example:"48.1"`
}

DNSRequest of a galaxy sector location.

type DNSResponse

type DNSResponse struct {
	Loc float64 `json:"loc" example:"27372.229"`
}

DNSResponse with a galaxy sector location.

type ErrorResponse

type ErrorResponse struct {
	Status  int    `json:"status" example:"404"`
	Message string `json:"message" example:"Not Found"`
	Errors  string `json:"errors,omitempty" example:"reference not found"`
}

ErrorResponse from the API.

type Params

type Params struct {
	Address string

	ExposeDebug bool
}

Params of the service.

type Server

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

Server for handling requests.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, params Params) error

Serve handlers.

Jump to

Keyboard shortcuts

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