first commit
This commit is contained in:
39
src/client/api/rest/routes.go
Normal file
39
src/client/api/rest/routes.go
Normal file
@ -0,0 +1,39 @@
|
||||
package rest
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
swaggerFiles "github.com/swaggo/files"
|
||||
ginSwagger "github.com/swaggo/gin-swagger"
|
||||
|
||||
_ "quantex.com/qfixpt/src/client/api/rest/docs" // Swag needs this import to work properly
|
||||
)
|
||||
|
||||
func SetRoutes(api *API) {
|
||||
cont := api.Controller
|
||||
|
||||
v1 := api.Router.Group("/qfixpt/v1")
|
||||
api.Router.Use(cont.Options)
|
||||
{
|
||||
auth := v1.Group("/auth")
|
||||
auth.POST("/login", cont.Login)
|
||||
}
|
||||
|
||||
qfixpt := v1.Group("/")
|
||||
qfixpt.Use(cont.AuthRequired)
|
||||
qfixpt.GET("/health", cont.HealthCheck)
|
||||
|
||||
backoffice := qfixpt.Group("/backoffice")
|
||||
backoffice.Use(cont.BackOfficeUser)
|
||||
|
||||
admin := qfixpt.Group("/admin")
|
||||
admin.Use(cont.SuperUser)
|
||||
|
||||
SetSwagger(v1, cont)
|
||||
}
|
||||
|
||||
func SetSwagger(path *gin.RouterGroup, cont *Controller) {
|
||||
auth := path.Group("/")
|
||||
auth.Use(cont.AuthRequired)
|
||||
|
||||
auth.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
||||
}
|
||||
Reference in New Issue
Block a user