mtgbot/router/routes/routes.go

28 lines
615 B
Go
Raw Normal View History

2018-12-24 06:34:13 +00:00
package routes
2018-12-24 09:34:24 +00:00
import (
"git.trj.tw/golang/mtgbot/modules/context"
"git.trj.tw/golang/mtgbot/router/line"
"github.com/gin-gonic/gin"
)
2018-12-24 06:34:13 +00:00
var r *gin.Engine
// NewEngine - new gin engine
func NewEngine() *gin.Engine {
r = gin.Default()
return r
}
// SetRoutes -
func SetRoutes(r *gin.Engine) {
r.GET("/", func(c *gin.Context) {
c.String(200, "Hello")
})
2018-12-24 09:34:24 +00:00
r.POST("/line", context.PatchCtx(line.GetRawBody), context.PatchCtx(line.VerifyLine), context.PatchCtx(line.LineWebhook))
r.POST("/line/", context.PatchCtx(line.GetRawBody), context.PatchCtx(line.VerifyLine), context.PatchCtx(line.LineWebhook))
2018-12-24 06:34:13 +00:00
}