Full Restruct API and Services
Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
@@ -11,9 +11,23 @@ import (
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/spf13/viper"
|
||||
swaggerFiles "github.com/swaggo/files"
|
||||
ginSwagger "github.com/swaggo/gin-swagger"
|
||||
"go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin"
|
||||
)
|
||||
|
||||
// @title NixCN CMS API
|
||||
// @version 1.0
|
||||
// @description API Docs based on Gin framework
|
||||
// @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 /api/v1
|
||||
// @schemes http https
|
||||
func Start(ctx context.Context) {
|
||||
if !viper.GetBool("server.debug_mode") {
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
@@ -25,6 +39,8 @@ func Start(ctx context.Context) {
|
||||
r.Use(middleware.GinLogger())
|
||||
r.Use(gin.Recovery())
|
||||
|
||||
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
||||
|
||||
api.Handler(r.Group("/api/v1"))
|
||||
|
||||
// Start http server
|
||||
|
||||
Reference in New Issue
Block a user