From ff73e0b5e9d9cb2f6141e22b284ff25cf12f75c7 Mon Sep 17 00:00:00 2001 From: Jannis Mattheis Date: Thu, 15 Mar 2018 21:51:37 +0100 Subject: [PATCH] Use uigo in router --- router/router.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/router/router.go b/router/router.go index 4e1bf75..c1bed58 100644 --- a/router/router.go +++ b/router/router.go @@ -8,6 +8,7 @@ import ( "github.com/gotify/server/auth" "github.com/gotify/server/database" "github.com/gotify/server/error" + "github.com/gotify/server/uigo" "github.com/jmattheis/go-packr-swagger-ui" "net/http" @@ -26,12 +27,13 @@ func Create(db *database.GormDatabase, vInfo *model.VersionInfo, conf *config.Co messageHandler := api.MessageAPI{Notifier: streamHandler, DB: db} tokenHandler := api.TokenAPI{DB: db} userHandler := api.UserAPI{DB: db, PasswordStrength: conf.PassStrength} - g := gin.New() g.Use(gin.Logger(), gin.Recovery(), error.Handler()) g.NoRoute(error.NotFound()) - g.GET("/") + + uigo.Register(g) + g.GET("/swagger", docs.Serve) g.GET("/docs/*any", gin.WrapH(http.StripPrefix("/docs/", http.FileServer(swaggerui.GetBox()))))