Documentation
¶
Overview ¶
Package faas is a OpenFaaS utility and helper function library designed to reduce boilerplate.
Index ¶
- func Background(fn func())
- func GetEnvOrError(env string) (string, error)
- func GetIpAddress(r *http.Request) string
- func GetSecret(secretName string) ([]byte, error)
- func GetSecretString(secretName string) (string, error)
- func ReadJSON(w http.ResponseWriter, r *http.Request, dst interface{}) error
- func ValidateCORS(w http.ResponseWriter, r *http.Request, origins []string) error
- func ValidateMethod(r *http.Request) error
- func WriteJSON(w http.ResponseWriter, status int, data any, headers http.Header) error
- type Error
- type Map
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Background ¶
func Background(fn func())
Background helper accepts an arbitrary function as a parameter.
func GetEnvOrError ¶
GetEnvOrError will return an error if the environment variable is not found.
func GetIpAddress ¶
GetIpAddress retrieves the requests remote address.
func GetSecretString ¶
func ReadJSON ¶
func ReadJSON(w http.ResponseWriter, r *http.Request, dst interface{}) error
ReadJSON is helper for trapping errors and return values for JSON related handlers
func ValidateCORS ¶
ValidateCORS will check that the request is from a valid origin.
func ValidateMethod ¶
ValidateMethod checks the http.Request is either GET or POST. Everything else returns an error.
Types ¶
Click to show internal directories.
Click to hide internal directories.