-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
45 lines (34 loc) · 983 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
//"go-tools/durable"
"go-tools/router"
"go-tools/utils"
"context"
"log"
_ "github.com/swaggo/swag"
"github.com/gin-gonic/gin"
swaggerfiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
)
// @title go-tools
// @version 1.0
// @description Go-Tools
// @contact.name Mohamed Sameem
// @contact.email [email protected]
// @BasePath /
func main() {
//durable.GormDB = durable.InitMysqlDb()
//defer durable.CloseDbConn(durable.GormDB)
r := router.SetupRouter(GinContextToContextMiddleware())
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler))
r.Run(":8036")
log.Println("Starting streamerx-backend service at port : 8036")
utils.HandleError("Error while starting server ", nil)
}
func GinContextToContextMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
ctx := context.WithValue(c.Request.Context(), "GinContextKey", c)
c.Request = c.Request.WithContext(ctx)
c.Next()
}
}