2fas-server/internal/common/http/server.go

23 lines
342 B
Go
Raw Permalink Normal View History

2022-12-31 10:22:38 +01:00
package http
import (
"github.com/gin-gonic/gin"
)
func RunHttpServer(addr string, init func(engine *gin.Engine)) {
router := gin.New()
router.Use(gin.Recovery())
router.Use(corsMiddleware())
2024-03-16 19:05:21 +01:00
router.Use(LoggingMiddleware())
2022-12-31 10:22:38 +01:00
router.Use(RequestJsonLogger())
init(router)
err := router.Run(addr)
if err != nil {
panic(err)
}
}