chore: custom error
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package restimage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"git.schreifuchs.ch/schreifuchs/schreifuchs.ch/internal/components/images"
|
||||
)
|
||||
|
||||
type Handler struct {
|
||||
img imageService
|
||||
}
|
||||
|
||||
func New(mux *http.ServeMux, srv imageService) *Handler {
|
||||
h := &Handler{
|
||||
img: srv,
|
||||
}
|
||||
|
||||
mux.HandleFunc("GET /images/{uid}", h.getImage)
|
||||
return h
|
||||
}
|
||||
|
||||
type imageService interface {
|
||||
GetImage(ctx context.Context, uid string, options images.Options) (img io.Reader, mimeType string, err error)
|
||||
}
|
||||
Reference in New Issue
Block a user