blob: 7066d9057b6ddc424dad9ffc64f9935a53cd316a (
plain)
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
|
package api
import "net/http"
func New(config Config) *Server {
mux := http.NewServeMux()
server := &http.Server{
Addr: config.Address,
Handler: mux,
}
srv := &Server{
config: config,
mux: mux,
http: server,
gallery: config.Gallery,
thumbnail: config.Thumbnails,
}
srv.mux.HandleFunc(
"GET /health",
srv.handleHealth,
)
srv.mux.HandleFunc(
"GET /api/photos",
srv.handlePhotos,
)
return srv
}
|