Documentation ¶
Index ¶
- func CORS(w http.ResponseWriter, r *http.Request, ps httprouter.Params, c *Config)
- func GetLink(w http.ResponseWriter, r *http.Request, ps httprouter.Params, c *Config)
- func GetRandom(w http.ResponseWriter, r *http.Request, ps httprouter.Params, c *Config)
- func InjectConfig(c *Config, ...) func(http.ResponseWriter, *http.Request, httprouter.Params)
- func NewRouter(config *Config) *httprouter.Router
- func PostLink(w http.ResponseWriter, r *http.Request, ps httprouter.Params, c *Config)
- type Config
- type PostLinkInput
- type PostLinkOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CORS ¶
func CORS(w http.ResponseWriter, r *http.Request, ps httprouter.Params, c *Config)
func GetLink ¶
func GetLink(w http.ResponseWriter, r *http.Request, ps httprouter.Params, c *Config)
func GetRandom ¶
func GetRandom(w http.ResponseWriter, r *http.Request, ps httprouter.Params, c *Config)
func InjectConfig ¶
func InjectConfig(c *Config, f func(http.ResponseWriter, *http.Request, httprouter.Params, *Config)) func(http.ResponseWriter, *http.Request, httprouter.Params)
Wraps an endpoint handler with a function that has access to a Config
func NewRouter ¶
func NewRouter(config *Config) *httprouter.Router
func PostLink ¶
func PostLink(w http.ResponseWriter, r *http.Request, ps httprouter.Params, c *Config)
We expect a multipart/form-data request containing:
- an optional "image"
- a "json" with the expected input as values
Types ¶
type Config ¶
type Config struct { RootPath string Template *template.Template LinkStore links.Store ImageStore images.Store ImageMaxWidth int ImageMaxHeight int }
Config is a container for all the interfaces and configuration options the API uses. It will be injected to the endpoints in order to allow them to access these options in a DI way
type PostLinkInput ¶
type PostLinkOutput ¶
type PostLinkOutput struct {
Slug string `json:"slug"`
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.