Documentation ¶
Index ¶
- func CreateDatabaseConnection(env string) (*pop.Connection, error)
- type Logger
- type Server
- func (s *Server) AddRoutes(serviceName string, apiPrefix string, createServiceRoutes func(*mux.Router))
- func (s *Server) Decode(w http.ResponseWriter, r *http.Request, data interface{}) error
- func (s *Server) HandleCatchAll() http.HandlerFunc
- func (s *Server) LoggingMiddleware() func(h http.Handler) http.Handler
- func (s *Server) Respond(w http.ResponseWriter, r *http.Request, data interface{}, status int)
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Server) StartHTTPServer()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDatabaseConnection ¶
func CreateDatabaseConnection(env string) (*pop.Connection, error)
CreateDatabaseConnection returns a pop connection
Types ¶
type Server ¶
type Server struct { IP string Port int Router *mux.Router Config config.Config Database *pop.Connection Logger *Logger }
Server holds all configuration or an http server
func (*Server) AddRoutes ¶
func (s *Server) AddRoutes(serviceName string, apiPrefix string, createServiceRoutes func(*mux.Router))
AddRoutes maps all common http endpoints & then calls the service routes function.
func (*Server) HandleCatchAll ¶
func (s *Server) HandleCatchAll() http.HandlerFunc
HandleCatchAll handles all none specified routes. This needs to be added as the last route in setup of the individual service.
func (*Server) LoggingMiddleware ¶
LoggingMiddleware logs every incoming request
func (*Server) ServeHTTP ¶
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP dispatches the handler registered in the matched route.
func (*Server) StartHTTPServer ¶
func (s *Server) StartHTTPServer()
StartHTTPServer starts the server
Source Files ¶
Click to show internal directories.
Click to hide internal directories.