Add request middleware to log incoming form params

This commit is contained in:
Dan Sosedoff
2015-08-04 10:38:23 -05:00
parent 639ca96caa
commit 2a4edaf08f
2 changed files with 20 additions and 1 deletions

View File

@@ -2,15 +2,24 @@ package api
import (
"github.com/gin-gonic/gin"
"github.com/sosedoff/pgweb/pkg/command"
)
func SetupMiddlewares(group *gin.RouterGroup) {
if command.Opts.Debug {
group.Use(requestInspectMiddleware())
}
group.Use(dbCheckMiddleware())
}
func SetupRoutes(router *gin.Engine) {
router.GET("/", GetHome)
router.GET("/static/*path", GetAsset)
api := router.Group("/api")
{
api.Use(dbCheckMiddleware())
SetupMiddlewares(api)
api.GET("/info", GetInfo)
api.POST("/connect", Connect)