-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
38 lines (32 loc) · 986 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
package main
import (
"toggl-deck-management-api/api"
_ "toggl-deck-management-api/docs"
"github.com/gin-gonic/gin"
swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
)
// @title Deck Management API
// @version 0.1
// @description This is a sample server server.
// @termsOfService http://swagger.io/terms/
// @contact.name API Support
// @contact.url http://www.swagger.io/support
// @contact.email [email protected]
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @host localhost:8080
// @BasePath /
// @schemes http
func main() {
gin.SetMode(gin.ReleaseMode)
r := gin.New()
r.Use(api.StructuredLogger())
r.Use(gin.Recovery())
r.POST("/create-deck", api.CreateDeckHandler)
r.GET("/open-deck", api.OpenDeckHandler)
r.PUT("/draw-cards", api.DrawCardsHandler)
url := ginSwagger.URL("/swagger/doc.json")
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, url))
r.Run()
}