Use uigo in router

This commit is contained in:
Jannis Mattheis 2018-03-15 21:51:37 +01:00 committed by Jannis Mattheis
parent 2e29efe90b
commit ff73e0b5e9
1 changed files with 4 additions and 2 deletions

View File

@ -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()))))