mtgbot/router/routes/routes.go

27 lines
522 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()
2019-01-18 08:50:31 +00:00
r.RedirectTrailingSlash = true
2018-12-24 06:34:13 +00:00
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))
2018-12-24 06:34:13 +00:00
}