Documentation ¶
Index ¶
- Constants
- Variables
- func Decode(r io.ReadCloser, data any) error
- func Encode(w http.ResponseWriter, r *http.Request, status int, data any) error
- func Intercept(target http.HandlerFunc, interceptors ...Interceptor) http.HandlerFunc
- type Certs
- type Code
- type Config
- type Error
- type Interceptor
- type Route
- type Transport
- type UI
Constants ¶
View Source
const GlobalUse = "*"
Variables ¶
Functions ¶
func Intercept ¶
func Intercept(target http.HandlerFunc, interceptors ...Interceptor) http.HandlerFunc
Types ¶
type Config ¶ added in v0.19.2
type Config struct { BasePath string `mapstructure:"basePath" envVar:"ATMK_TRANSPORT_BASEPATH"` Name string `mapstructure:"name" envVar:"ATMK_TRANSPORT_NAME"` Port string `mapstructure:"port" envVar:"ATMK_TRANSPORT_PORT"` WWW string `mapstructure:"www" envVar:"ATMK_TRANSPORT_WWW"` // CORS AllowedOrigins []string `mapstructure:"allowedOrigins" envVar:"ATMK_CORS_ORIGINS"` AllowedMethods []string `mapstructure:"allowedMethods" envVar:"ATMK_CORS_METHODS"` AllowedHeaders []string `mapstructure:"allowedHeaders" envVar:"ATMK_CORS_HEADERS"` AllowCredentials bool `mapstructure:"allowCredentials" envVar:"ATMK_CORS_CREDS"` // TLS TlsCa string `mapstructure:"tlsCa" envVar:"ATMK_TLS_CA"` TlsCert string `mapstructure:"tlsCert" envVar:"ATMK_TLS_CERT"` TlsKey string `mapstructure:"tlsKey" envVar:"ATMK_TLS_KEY"` }
type Interceptor ¶
type Interceptor interface {
Intercept(http.HandlerFunc) http.HandlerFunc
}
Interceptor definition
type Route ¶
type Route struct { ServiceName string ActionName string Handler http.HandlerFunc Method string }
type Transport ¶
type Transport interface { atomika.Service OnError(w http.ResponseWriter, r *http.Request, err error) Register(route Route) ServeHTTP(w http.ResponseWriter, r *http.Request) Use(route string, interceptorsList []Interceptor) UI(ui *UI) }
type UI ¶ added in v0.19.2
type UI struct { Dir string FS http.FileSystem }
UI allows adding ui support to the project. this will mount the handler on "/" (root) path and will overwrite anything else if present This UI mounting style is designed to work with SPA/WASM app style To activate UI - Pass a relative/abs path in DIR or - Pass an FS files system http.FS(fs.Sub())
func NewWithEmptyHandler ¶ added in v0.19.2
func NewWithEmptyHandler() *UI
Click to show internal directories.
Click to hide internal directories.