go-ddns-svc/route/routes/routes.go
2019-05-03 17:17:44 +08:00

32 lines
536 B
Go

package routes
import (
"net/http"
"git.trj.tw/golang/go-ddns-svc/module/context"
"git.trj.tw/golang/go-ddns-svc/route/api"
"github.com/gin-gonic/gin"
)
var e *gin.Engine
// NewEngine -
func NewEngine() *gin.Engine {
e = gin.New()
e.Use(gin.Logger())
e.Use(gin.Recovery())
return e
}
// SetRoutes -
func SetRoutes() {
e.GET("/", func(c *gin.Context) {
c.String(http.StatusOK, "OK")
})
apiGroup := e.Group("/api", context.PatchCtx(api.VerifyPrivate))
{
apiGroup.POST("/ddns", context.PatchCtx(api.UpdateDDNS))
}
}