-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
46 lines (38 loc) · 1.12 KB
/
main.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
39
40
41
42
43
44
package main
import (
"github.com/gorilla/mux"
"image-analysis-tools-aggregator/cache"
"image-analysis-tools-aggregator/logging"
"image-analysis-tools-aggregator/rest"
"image-analysis-tools-aggregator/utils"
"net/http"
)
var (
addr string
)
func main(){
initService()
mux := mux.NewRouter()
mux.HandleFunc("/upload-image", rest.UploadImage).
Methods("POST")
mux.HandleFunc("/get-image-info", rest.GetImageFileInfo).
Methods("GET")
mux.HandleFunc("/get-fft", rest.GetFourierTransform).
Methods("GET")
mux.HandleFunc("/get-image-palette", rest.GetImagePalette).
Methods("GET")
mux.HandleFunc("/get-image-bit-planes", rest.GetBitPlanes).
Methods("GET")
mux.HandleFunc("/get-edge-detection-result", rest.GetImageFileInfo).
Methods("GET")
mux.HandleFunc("/get-image-segmentation-result", rest.GetFourierTransform).
Methods("GET")
mux.HandleFunc("/get-rgb-histogram", rest.GetRGBHistogram).
Methods("GET")
logging.InfoFormat("starting server at %s...", addr)
cache.InitCache(cache.GetCacheConfig())
http.ListenAndServe(addr, mux)
}
func initService() {
addr = utils.GetEnv(utils.ListenAddressEnvKey, ":8080")
}