Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadUserIP ¶
Types ¶
type API ¶
type API struct { BaseGinServer // contains filtered or unexported fields }
func NewAPI ¶
func NewAPI( log *zap.Logger, config *Config, shortyService *service.ShortyService, qrSvc *service.QRCodeService, ) *API
type AuthenticationMiddleware ¶
type AuthenticationMiddleware struct {
// contains filtered or unexported fields
}
func NewAuthenticationMiddleware ¶
func NewAuthenticationMiddleware(token string) *AuthenticationMiddleware
func (*AuthenticationMiddleware) Authenticated ¶
func (a *AuthenticationMiddleware) Authenticated(c *gin.Context)
type BaseGinServer ¶
type BaseGinServer struct{}
func (*BaseGinServer) PushHandlerWithGroup ¶
func (*BaseGinServer) PushHandlerWithGroup(h HTTPHandler, rg *gin.RouterGroup)
type Config ¶
type Config struct { Port int `env:"API_PORT"` Token string `env:"AUTH_TOKEN"` HostName string `env:"HOST_NAME"` UnknownPage string `env:"UNKNOWN_PAGE"` QRLogo string `env:"QR_PNG_LOGO"` DBUsername string `env:"DB_USERNAME"` DBPassword string `env:"DB_PASSWORD"` DBName string `env:"DB_NAME"` DBHost string `env:"DB_URL"` DBPort int `env:"DB_PORT"` SSLMode string `env:"SSL_MODE"` PublicIDLength int `env:"PUBLIC_ID_LENGTH"` }
func (*Config) GetDatabaseConfig ¶
type HTTPHandler ¶
type HTTPHandler interface { Routes(rg *gin.RouterGroup) Group() *string }
func NewPreviewHandler ¶
func NewPreviewHandler(qrSvc *service.QRCodeService) HTTPHandler
func NewShortenerHandler ¶
func NewShortenerHandler(shortySvc *service.ShortyService) HTTPHandler
func NewURLHandler ¶
func NewURLHandler(unknownPage string, svc *service.ShortyService) HTTPHandler
type Server ¶
type Server interface {
PushHandlerWithGroup(h HTTPHandler, rg *gin.RouterGroup)
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.