server

package
v1.0.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2017 License: GPL-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ServiceName is used for HTTP API
	ServiceName = "GEF"
	// Version defines the api version
	Version = "0.3.0"
)

Variables

View Source
var (
	AccessTokenQueryParam = "access_token"
	AccessTokenCookieKey  = "UIAccessToken"
)

Functions

func InitEventSystem

func InitEventSystem(address string)

InitEventSystem initializes the event system, or disables it if the address is empty

Types

type Authorization

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

type Response

type Response struct {
	http.ResponseWriter
}

Response encapsulates a http ResponseWriter

func (Response) ClientError

func (w Response) ClientError(message string, err error)

ClientError sets a 400 error

func (Response) Created

func (w Response) Created(body interface{})

Created sets 201/created response code and body

func (Response) DirectiveError

func (w Response) DirectiveError()

DirectiveError sets a 403 error

func (Response) Forbidden

func (w Response) Forbidden(msg string)

Forbidden sets a 403 error

func (Response) Location

func (w Response) Location(loc string) Response

Location sets location header

func (Response) Ok

func (w Response) Ok(body interface{})

Ok sets 200/ok response code and body

func (Response) ServerError

func (w Response) ServerError(message string, err error)

ServerError sets a 500/server error

func (Response) ServerNewError

func (w Response) ServerNewError(message string)

ServerNewError sets a 500/server error

func (Response) Unauthorized

func (w Response) Unauthorized()

Unauthorized sets a 401 error

type Server

type Server struct {
	Server                 http.Server
	TLSCertificateFilePath string
	TLSKeyFilePath         string
	// contains filtered or unexported fields
}

Server is a master struct for serving HTTP API requests

func NewServer

func NewServer(cfg def.Configuration, pier *pier.Pier, database *db.Db) (*Server, error)

NewServer creates a new Server

func (*Server) Start

func (s *Server) Start() error

Start starts a new http listener

Jump to

Keyboard shortcuts

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