Upstream sync
This commit is contained in:
@@ -12,12 +12,12 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterProtectedRoutes(r *gin.Engine){
|
||||
func RegisterProtectedRoutes(r *gin.Engine) {
|
||||
|
||||
authGroup := r.Group("/auth")
|
||||
|
||||
authGroup.Use(middlewares.AuthHandler("admin"))
|
||||
{
|
||||
authGroup.GET("/getmessage",controllers.GetSecretText)
|
||||
authGroup.GET("/getmessage", controllers.GetSecretText)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,8 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func RegisterPublicRoutes(r *gin.Engine){
|
||||
func RegisterPublicRoutes(r *gin.Engine) {
|
||||
|
||||
r.GET("/publicmessage", controllers.GetPublicText)
|
||||
r.POST("/device_info", controllers.SaveDeviceInfofunc)
|
||||
}
|
||||
|
||||
|
||||
@@ -15,12 +15,12 @@ import (
|
||||
func InitRouter(engine *gin.Engine) {
|
||||
InitMiddleware(engine)
|
||||
authController := new(controllers.AuthController)
|
||||
engine.POST("/login", authController.HandleLogin)
|
||||
engine.POST("/login", authController.HandleLogin)
|
||||
RegisterProtectedRoutes(engine)
|
||||
RegisterPublicRoutes(engine)
|
||||
RegisterUtilityRoutes(engine)
|
||||
}
|
||||
|
||||
func InitMiddleware(engine *gin.Engine){
|
||||
engine.Use(middlewares.CORSMiddleware());
|
||||
}
|
||||
func InitMiddleware(engine *gin.Engine) {
|
||||
engine.Use(middlewares.CORSMiddleware())
|
||||
}
|
||||
|
||||
@@ -6,13 +6,13 @@ package routes
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
|
||||
func RegisterUtilityRoutes(r *gin.Engine){
|
||||
func RegisterUtilityRoutes(r *gin.Engine) {
|
||||
registerRing(r)
|
||||
}
|
||||
|
||||
func registerRing(r *gin.Engine){
|
||||
func registerRing(r *gin.Engine) {
|
||||
// Ping test
|
||||
r.GET("/ping", func(c *gin.Context) {
|
||||
c.String(200, "pong")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user