-
Notifications
You must be signed in to change notification settings - Fork 198
/
Copy pathsimple.go
38 lines (35 loc) · 1.17 KB
/
simple.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Package simple provides a simple example.
package main
import (
"net/http"
"github.com/pierrre/imageserver"
imageserver_http "github.com/pierrre/imageserver/http"
imageserver_http_gift "github.com/pierrre/imageserver/http/gift"
imageserver_http_image "github.com/pierrre/imageserver/http/image"
imageserver_image "github.com/pierrre/imageserver/image"
_ "github.com/pierrre/imageserver/image/gif"
imageserver_image_gift "github.com/pierrre/imageserver/image/gift"
_ "github.com/pierrre/imageserver/image/jpeg"
_ "github.com/pierrre/imageserver/image/png"
imageserver_testdata "github.com/pierrre/imageserver/testdata"
)
func main() {
http.Handle("/", &imageserver_http.Handler{
Parser: imageserver_http.ListParser([]imageserver_http.Parser{
&imageserver_http.SourceParser{},
&imageserver_http_gift.ResizeParser{},
&imageserver_http_image.FormatParser{},
&imageserver_http_image.QualityParser{},
}),
Server: &imageserver.HandlerServer{
Server: imageserver_testdata.Server,
Handler: &imageserver_image.Handler{
Processor: &imageserver_image_gift.ResizeProcessor{},
},
},
})
err := http.ListenAndServe(":8080", nil)
if err != nil {
panic(err)
}
}