2fas-server/internal/common/http/server.go
2022-12-31 10:22:38 +01:00

24 lines
383 B
Go

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())
router.Use(RequestIdMiddleware())
router.Use(CorrelationIdMiddleware())
router.Use(RequestJsonLogger())
init(router)
err := router.Run(addr)
if err != nil {
panic(err)
}
}