-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
36 lines (26 loc) · 847 Bytes
/
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
package main
import (
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"github.com/ken20001207/image-compressor/controllers"
"github.com/ken20001207/image-compressor/redis"
)
func main() {
redis.NewRedisClient()
r := gin.Default()
// CORS
config := cors.DefaultConfig()
config.AllowCredentials = true
config.AllowOrigins = []string{"*"}
r.Use(cors.New(config))
r.GET("/", controllers.HealthCheck)
// Upload a .bmp image and get a id
r.POST("/upload", controllers.UploadImage)
// Get result of specific step of compression process
r.GET("/visualization", controllers.VisualizationController)
// Download .compressed file from given id
r.GET("/compressed", controllers.CompressedController)
// Decompress .compressed file into .bmp file
r.POST("/decompress", controllers.DecompressController)
panic(r.Run())
}