server

package module
v0.0.0-...-4289f7d Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dispatch

func Dispatch(ctx *gin.Context, command c.Command)

Dispatch initiates and handles the request and response

Types

type Server

type Server struct {
	Env          string
	Location     string
	Configurator c.Configurator
	Repository   c.IRepository
	Mode         string
	Router       *gin.Engine
	Routes       []c.Route
	TimeOuts     TimeOuts
}

Server represents the encapulsation of a service Don't rely on server defaults as this could significant impact performance] https://blog.cloudflare.com/the-complete-guide-to-golang-net-http-timeouts/

func NewServer

func NewServer(routes []c.Route) *Server

NewServer creates a new server

func (*Server) Configure

func (s *Server) Configure()

Configure returns the router that will be returned

func (*Server) CreateRouter

func (s *Server) CreateRouter() *gin.Engine

CreateRouter returns the router that will be returned

func (*Server) Start

func (s *Server) Start()

Start the server and ensure it's configured

type TimeOuts

type TimeOuts struct {
	Read   time.Duration
	Write  time.Duration
	Hammer time.Duration
}

TimeOuts represents the server timeout config

Jump to

Keyboard shortcuts

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