Documentation ¶
Index ¶
- type Middleware
- type Module
- type Route
- type Server
- func (s *Server) AddGET(r Route) string
- func (s *Server) AddMod(m Module)
- func (s *Server) AddPOST(r Route) string
- func (s *Server) Logger() echo.Logger
- func (s *Server) Shutdown()
- func (s *Server) ShutdownWithContext(parent context.Context)
- func (s *Server) Start(done chan error)
- func (s *Server) StartOn(port string, initError chan error)
- func (s *Server) UseMiddleware(m Middleware)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Middleware ¶ added in v0.0.11
type Middleware interface {
Handler() func(next echo.HandlerFunc) echo.HandlerFunc
}
Middleware defines a method for the server to find the handler function
type Module ¶
The Module interface defines the methods that all gonia modules must implement. Init is called on server startup, before handling connections Cleanup is called on server shutdown, before closing the server
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Route describes an http route and handler with path and a handler function.
func NewRouteNamed ¶ added in v0.0.18
NewRouteNamed creates a new route with the given path, name, and handlerFunc.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the top-level gonia object
func NewWithRouter ¶ added in v0.0.21
NewWithRouter creates a new server given an existing router
func (*Server) AddMod ¶ added in v0.0.5
AddMod installs a Module on the list of modules to be initialized and cleaned up buy the server. This must be called before Start()
func (*Server) Logger ¶ added in v0.0.20
func (s *Server) Logger() echo.Logger
Logger returns the underlying echo.Logger
func (*Server) Shutdown ¶
func (s *Server) Shutdown()
Shutdown is a convenience method that calls shuts down the server with a nil Context
func (*Server) ShutdownWithContext ¶ added in v0.0.22
Shutdown stops the server. Before stopping, the server will call the Cleanup method on any installed Modules if parent is nil the function will use context.Background()
func (*Server) Start ¶
Start begins serving on port 8080 The server will call the Init method on any installed Modules before serving The done channel will have the error if startup fails.
func (*Server) StartOn ¶ added in v0.0.16
StartOn begins serving on the given port. The server will call the Init method on any installed Modules before serving The done channel will have the error if startup fails.
func (*Server) UseMiddleware ¶ added in v0.0.11
func (s *Server) UseMiddleware(m Middleware)
UseMiddleware will install the Middleware for all paths