go-ddns-svc/route/routes/routes.go

32 lines
536 B
Go
Raw Normal View History

2019-05-02 03:51:48 +00:00
package routes
import (
"net/http"
2019-05-03 09:17:44 +00:00
"git.trj.tw/golang/go-ddns-svc/module/context"
"git.trj.tw/golang/go-ddns-svc/route/api"
2019-05-02 03:51:48 +00:00
"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")
})
2019-05-03 09:17:44 +00:00
apiGroup := e.Group("/api", context.PatchCtx(api.VerifyPrivate))
{
apiGroup.POST("/ddns", context.PatchCtx(api.UpdateDDNS))
}
2019-05-02 03:51:48 +00:00
}