Documentation
¶
Index ¶
Constants ¶
View Source
const ( ContentTypeJSON = "application/json" MaxBodySize = 1 << 20 // 1 MB )
View Source
const (
ServerName = "rest"
)
Variables ¶
This section is empty.
Functions ¶
func NewDefaultHandler ¶
func NewDefaultHandler[T transaction.Tx](appManager appmanager.AppManager[T]) http.Handler
Types ¶
type CfgOption ¶
type CfgOption func(*Config)
func OverwriteDefaultConfig ¶
OverwriteDefaultConfig overwrites the default config with the new config.
type Config ¶
type Config struct { // Enable defines if the REST server should be enabled. Enable bool `mapstructure:"enable" toml:"enable" comment:"Enable defines if the REST server should be enabled."` // Address defines the API server to listen on Address string `mapstructure:"address" toml:"address" comment:"Address defines the REST server address to bind to."` }
Config defines configuration for the REST server.
func DefaultConfig ¶
func DefaultConfig() *Config
type DefaultHandler ¶
type DefaultHandler[T transaction.Tx] struct { // contains filtered or unexported fields }
func (*DefaultHandler[T]) ServeHTTP ¶
func (h *DefaultHandler[T]) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Server ¶
type Server[T transaction.Tx] struct { // contains filtered or unexported fields }
func New ¶
func New[T transaction.Tx]( logger log.Logger, appManager appmanager.AppManager[T], cfg server.ConfigMap, cfgOptions ...CfgOption, ) (*Server[T], error)
func NewWithConfigOptions ¶
func NewWithConfigOptions[T transaction.Tx](opts ...CfgOption) *Server[T]
NewWithConfigOptions creates a new REST server with the provided config options. It is *not* a fully functional server (since it has been created without dependencies) The returned server should only be used to get and set configuration.
Click to show internal directories.
Click to hide internal directories.