Documentation ¶
Index ¶
- func WithHostAddr(addr string) func(*Api)
- func WithMiddleware(m ...mux.MiddlewareFunc) func(*Api)
- func WithStorage(store asset.Store) func(*Api)
- type Api
- func (a *Api) HandleAsset(w http.ResponseWriter, r *http.Request)
- func (a *Api) HandleAssetList(w http.ResponseWriter, r *http.Request)
- func (a *Api) HandleDraw(w http.ResponseWriter, r *http.Request)
- func (a *Api) HandleUpdates(w http.ResponseWriter, r *http.Request)
- func (a *Api) HandleUpload(w http.ResponseWriter, r *http.Request)
- func (a *Api) ListenAndServe() error
- type Middleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithHostAddr ¶
WithHostAddr applies a IP:Port pair to the API on which it will start to listen
func WithStorage ¶
WithStorage applies a custom storage path to the API under which uploaded image and gifs will be stored
Types ¶
type Api ¶
type Api struct {
// contains filtered or unexported fields
}
func New ¶
New returns a new Api instance. If no address is provided the API will listen on its default address "127.0.0.1:8080"
func (*Api) HandleAsset ¶
func (a *Api) HandleAsset(w http.ResponseWriter, r *http.Request)
func (*Api) HandleAssetList ¶
func (a *Api) HandleAssetList(w http.ResponseWriter, r *http.Request)
func (*Api) HandleDraw ¶
func (a *Api) HandleDraw(w http.ResponseWriter, r *http.Request)
func (*Api) HandleUpdates ¶
func (a *Api) HandleUpdates(w http.ResponseWriter, r *http.Request)
func (*Api) HandleUpload ¶
func (a *Api) HandleUpload(w http.ResponseWriter, r *http.Request)
HandleUpload concerns request which upload either: - an image with the dimensions of 16x16 and are .png - a gif with the dimensions of 16x16 if either the dimensions don't match or the file extensions get violated the endpoint returns a http.StatusBadRequest
func (*Api) ListenAndServe ¶
ListenAndServer start the Api-Server on the given address
type Middleware ¶
Click to show internal directories.
Click to hide internal directories.