You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
753 B
Go

package main
import (
"fmt"
"github.com/gin-gonic/gin"
"jypay/api"
"jypay/global"
"jypay/initialize"
"jypay/utils"
)
func main() {
global.Config = initialize.InitConfig()
global.DB = initialize.InitDB(global.Config)
fmt.Println(global.Config)
r := gin.Default()
r.GET("/ping", utils.BuildJsonHandler(api.Index))
r.GET("/error", utils.BuildJsonHandler(api.Error))
r.POST("/pay", utils.BuildJsonHandler(api.Pay))
r.POST("/payment/:token", utils.BuildHandler(api.Payment))
r.POST("/notify", utils.BuildHandler(api.Notify))
r.GET("/return/:order_no", utils.BuildHandler(api.Return))
r.GET("/test-post", utils.BuildJsonHandler(api.TestPost))
err := r.Run(":" + global.Config.Server.Port) // listen and serve on 0.0.0.0:8080
panic(err)
}