46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
package routes
|
|
|
|
import (
|
|
_ "framework_v2/docs"
|
|
"framework_v2/internal/handlers/controllers/user"
|
|
"framework_v2/internal/middleware/http"
|
|
"framework_v2/internal/providers"
|
|
"github.com/gin-gonic/gin"
|
|
swaggerFiles "github.com/swaggo/files"
|
|
ginSwagger "github.com/swaggo/gin-swagger"
|
|
)
|
|
|
|
var r = *providers.MustGet[gin.Engine]()
|
|
|
|
// @title Swagger Example API
|
|
// @version 1.0
|
|
// @description This is a sample server celler server.
|
|
// @termsOfService http://swagger.io/terms/
|
|
|
|
// @contact.name API Support
|
|
// @contact.url http://www.swagger.io/support
|
|
// @contact.email support@swagger.io
|
|
|
|
// @license.name Apache 2.0
|
|
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
|
|
|
|
// @host localhost:8080
|
|
// @BasePath /
|
|
|
|
// @securityDefinitions.apikey ApiKeyAuth
|
|
//
|
|
// @in header
|
|
// @name Authorization
|
|
// @description Description for what is this security definition being used
|
|
// InitApiRoutes init api routes
|
|
func InitApiRoutes() {
|
|
var userController = user.NewUserController()
|
|
|
|
r.GET("/", http.MiddlewareJSONResponse, http.RequireJWTIDToken, userController.CurrentUser)
|
|
}
|
|
|
|
// InitSwaggerRoutes init swagger routes
|
|
func InitSwaggerRoutes() {
|
|
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
|
}
|