-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.go
49 lines (40 loc) · 1.47 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
45
46
47
48
49
package main
import (
"fmt"
"com.lc.go.codepush/server/config"
"com.lc.go.codepush/server/middleware"
"com.lc.go.codepush/server/request"
"github.com/gin-contrib/gzip"
"github.com/gin-gonic/gin"
)
func main() {
fmt.Println("code-push-server-go V1.0.5")
// gin.SetMode(gin.ReleaseMode)
g := gin.Default()
g.Use(gzip.Gzip(gzip.DefaultCompression))
g.Use(middleware.Recover)
configs := config.GetConfig()
// g.Static("/bundels", "bundels")
g.GET("/v0.1/public/codepush/update_check", request.Client{}.CheckUpdate)
g.POST("/v0.1/public/codepush/report_status/deploy", request.Client{}.ReportStatus)
g.POST("/v0.1/public/codepush/report_status/download", request.Client{}.Download)
apiGroup := g.Group(configs.UrlPrefix)
{
apiGroup.POST("/login", request.User{}.Login)
}
authApi := apiGroup.Use(middleware.CheckToken)
{
authApi.POST("/createApp", request.App{}.CreateApp)
authApi.POST("/createDeployment", request.App{}.CreateDeployment)
authApi.POST("/createBundle", request.App{}.CreateBundle)
authApi.POST("/checkBundle", request.App{}.CheckBundle)
authApi.POST("/delApp", request.App{}.DelApp)
authApi.POST("/delDeployment", request.App{}.DelDeployment)
authApi.POST("/lsDeployment", request.App{}.LsDeployment)
authApi.GET("/lsApp", request.App{}.LsApp)
authApi.POST("/uploadBundle", request.App{}.UploadBundle)
authApi.POST("/rollback", request.App{}.Rollback)
authApi.POST("/changePassword", request.User{}.ChangePassword)
}
g.Run(configs.Port)
}