Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Counter ¶
The Counter Controller. The controller instance is always the same and shared across requests, why? Because it contains a single field which binds to a static dependency. Service is a static dependency, why? Because it does not rely on iris.Context or any other dynamic dependency.
The `GetIncrement` method relies on a dynamic dependency, because it depends on the incoming request (access log). That input argument will be a new instance of accesslog.Fields on every single new request.
func (*Counter) Get ¶
func (c *Counter) Get() models.CounterResponse
Get handles the GET */ path. Returns the current counter.
func (*Counter) HandleError ¶
HandleError catches controller's methods and servetime dependency-injection errors.
func (*Counter) HandleHTTPError ¶
HandleHTTPError catches HTTP Errors under the controller's party (prefix path).
Responds the http error with JSON.
func (*Counter) PostIncrement ¶
func (c *Counter) PostIncrement(fields *accesslog.Fields) models.CounterResponse
PostIncrement handles the POST */increment of this controller's Party.
Responds the new counter value with JSON. Access a registered request-time dependency of *accesslog.Fields in order to set custom log fields (e.g. current 'counter') in the log file.