Documentation
¶
Overview ¶
Package api: provides a simple way to create a new API This package is a wrapper of echo framework. https://echo.labstack.com/ The package api is ready for integration with swagger.
Index ¶
Constants ¶
const ( CONF_HTTP_PORT = "HTTP_PORT" CONF_HTTP_SSL = "HTTP_SSL_ENABLE" CONF_HTTP_CERT = "HTTP_SSL_CERT" CONF_HTTP_KEY = "HTTP_SSL_KEY" CONF_HTTP_SWAGGER = "HTTP_SWAGGER_ENABLE" )
Variables ¶
var ( // ConfigurationPrefix is the prefix for the configuration keys. // Default is empty. // Example: // - if ConfigurationPrefix is "APP", the configuration key for host will be "APP_PGSQL_HOST". // After the call to config(), the ConfigurationPrefix is reset to empty. ConfigurationPrefix = "" )
var ( // ErrMissingConfig is the error returned when a config key is missing. ErrMissingConfig = errors.New("missing config key") )
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface { // SubRouter return with the prefix path specified on parameter // jwtSecure is a flag to enable jwt middleware // the jwtSecure is not implemented yet SubRouter(prefix string, jwtSecure bool) (*echo.Group, error) // Start run the server on the port specified on config Start() error }
API wrap the echo framwork Provides a simple way to create a new API Featuring wiht healthcheck and swagger endpoints
func New ¶
New instance of API. The config is loaded automatically. New method assume that the loader is initialized via viper.
func NewWithConfig ¶
NewWithConfig instance of API. The config is loaded from parameter.
type Handler ¶
type Handler struct{}
func (Handler) Healthcheck ¶
Healthcheck method @Summary Healthcheck @Description return the healthcheck of the service @Tags healthcheck @Produce json @Success 200 {object} Healthcheck @Router /healthcheck [get]
type Healthcheck ¶
type Healthcheck struct {
Health bool `json:"health"`
}
Healthcheck model to describe the response http of the healthcheck endpoint. @Description return the healthcheck of the service @Description Health field is true if the service is healthy