services

package
v0.0.0-...-5e23df6 Latest Latest
Warning

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

Go to latest
Published: May 20, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticate

func Authenticate(r *http.Request) (authenticated bool, httpStatus int)

func WriteError

func WriteError(w http.ResponseWriter, err error, httpStatus int)

Types

type Handler404

type Handler404 struct{}

create a 404 handler - default content type is json

func (*Handler404) ServeHTTP

func (m *Handler404) ServeHTTP(w http.ResponseWriter, req *http.Request)

type ResponseError

type ResponseError struct {
	ErrorCode string `json:"errorCode,omitempty"`
	FieldName string `json:"fieldName,omitempty"`
	Message   string `json:"message,omitempty"`
}

type ResponseStatus

type ResponseStatus struct {
	ErrorCode string          `json:"errorCode,omitempty"`
	Message   string          `json:"message,omitempty"`
	Errors    []ResponseError `json:"errors,omitempty"`
}

type ReturnData

type ReturnData interface{}

create service handler - default content type is json

type Service

type Service struct {
	Name        string
	Description string
	Params      string
	Port        string
	Version     string
	// contains filtered or unexported fields
}

func Create

func Create(name string, port string, description string, version string) *Service

Create a new service

func (*Service) Handler404

func (m *Service) Handler404(w http.ResponseWriter, req *http.Request)

func (*Service) RegisterPath

func (m *Service) RegisterPath(path string, httpMethod string, f ServiceHandler, authenticate bool)

func (*Service) RequestHandler

func (m *Service) RequestHandler(w http.ResponseWriter, r *http.Request, p httprouter.Params)

func (*Service) Start

func (m *Service) Start()

Jump to

Keyboard shortcuts

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