mirror of
https://github.com/twofas/2fas-server.git
synced 2024-12-12 12:09:56 +01:00
24 lines
383 B
Go
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)
|
|
}
|
|
}
|