http

package
v0.0.0-...-d563f25 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminOnly

func AdminOnly(next http.Handler) http.Handler

AdminOnly ..

Types

type ErrorResponse

type ErrorResponse struct {
	Code    string        `json:"code"`
	Message string        `json:"message"`
	Fields  []*FieldError `json:"fields"`
}

ErrorResponse represents the default error response

type FieldError

type FieldError struct {
	Field   string `json:"field"`
	Message string `json:"message"`
}

FieldError represents error message for each field

type Responder

type Responder struct {
}

Responder represents the http responder interface

func NewResponder

func NewResponder() *Responder

NewResponder creates a new http responder

func (*Responder) Error

func (r *Responder) Error(w http.ResponseWriter, status int, err error)

Error writes error http response

func (*Responder) HTML

func (r *Responder) HTML(w http.ResponseWriter, status int, data interface{})

HTML writes html http response

func (*Responder) JSON

func (r *Responder) JSON(w http.ResponseWriter, status int, data interface{})

JSON writes json http response

type Server

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

Server represents the http server that handles the requests

func NewServer

func NewServer(
	userService user.ServiceInterface,
	characterService character.ServiceInterface,
	dataManager *data.Manager,
	config *config.Config,
	utility *util.Utility,
	httpManager *hosts.HTTPManager,
) *Server

NewServer creates a new http server

func (*Server) Serve

func (hs *Server) Serve()

Serve serves http requests

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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