63 lines
1.6 KiB
Go
63 lines
1.6 KiB
Go
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
swaggerFiles "github.com/swaggo/files"
|
|
ginSwagger "github.com/swaggo/gin-swagger"
|
|
)
|
|
|
|
// @title CarrotSkin API
|
|
// @version 1.0
|
|
// @description CarrotSkin 是一个优秀的 Minecraft 皮肤站 API 服务
|
|
// @description
|
|
// @description ## 功能特性
|
|
// @description - 用户注册/登录/管理
|
|
// @description - 材质上传/下载/管理
|
|
// @description - Minecraft 档案管理
|
|
// @description - 权限控制系统
|
|
// @description - 积分系统
|
|
// @description
|
|
// @description ## 认证方式
|
|
// @description 使用 JWT Token 进行身份认证,需要在请求头中包含:
|
|
// @description ```
|
|
// @description Authorization: Bearer <your-jwt-token>
|
|
// @description ```
|
|
|
|
// @contact.name CarrotSkin Team
|
|
// @contact.email support@carrotskin.com
|
|
// @license.name MIT
|
|
// @license.url https://opensource.org/licenses/MIT
|
|
|
|
// @host localhost:8080
|
|
// @BasePath /api/v1
|
|
|
|
// @securityDefinitions.apikey BearerAuth
|
|
// @in header
|
|
// @name Authorization
|
|
// @description Type "Bearer" followed by a space and JWT token.
|
|
|
|
func SetupSwagger(router *gin.Engine) {
|
|
// Swagger文档路由
|
|
router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
|
|
|
// 健康检查接口
|
|
router.GET("/health", HealthCheck)
|
|
}
|
|
|
|
// HealthCheck 健康检查
|
|
// @Summary 健康检查
|
|
// @Description 检查服务是否正常运行
|
|
// @Tags system
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Success 200 {object} map[string]interface{} "成功"
|
|
// @Router /health [get]
|
|
func HealthCheck(c *gin.Context) {
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"status": "ok",
|
|
"message": "CarrotSkin API is running",
|
|
})
|
|
}
|