2024-08-01 23:03:51 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-08-02 17:14:06 +02:00
|
|
|
"github.com/swaggo/files"
|
|
|
|
"github.com/swaggo/gin-swagger"
|
2024-08-01 23:03:51 +02:00
|
|
|
|
2024-08-02 17:14:06 +02:00
|
|
|
docs "git.qowevisa.me/Qowevisa/gonuts/docs"
|
2024-08-02 22:37:16 +02:00
|
|
|
"git.qowevisa.me/Qowevisa/gonuts/handlers"
|
|
|
|
"git.qowevisa.me/Qowevisa/gonuts/tokens"
|
2024-08-02 17:14:06 +02:00
|
|
|
"github.com/gin-gonic/gin"
|
2024-08-01 23:03:51 +02:00
|
|
|
)
|
|
|
|
|
2024-08-02 17:14:06 +02:00
|
|
|
// @title Swagger Example API
|
|
|
|
// @version 1.0
|
|
|
|
// @description This is a sample server celler server.
|
|
|
|
// @termsOfService http://swagger.io/terms/
|
|
|
|
|
|
|
|
// @contact.name API Support
|
|
|
|
// @contact.url http://www.swagger.io/support
|
|
|
|
// @contact.email support@swagger.io
|
|
|
|
|
|
|
|
// @license.name Apache 2.0
|
|
|
|
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
|
|
|
|
|
|
|
|
// @host localhost:3000
|
|
|
|
// @BasePath /api
|
2024-08-01 23:03:51 +02:00
|
|
|
func main() {
|
2024-08-02 17:14:06 +02:00
|
|
|
r := gin.Default()
|
|
|
|
docs.SwaggerInfo.BasePath = "/api"
|
|
|
|
|
|
|
|
// Routes defined in the routes package
|
2024-08-02 23:07:14 +02:00
|
|
|
api := r.Group("/api")
|
2024-08-02 17:14:06 +02:00
|
|
|
{
|
2024-08-02 23:07:14 +02:00
|
|
|
userRoutes := api.Group("/user")
|
2024-08-02 23:06:21 +02:00
|
|
|
{
|
|
|
|
userRoutes.POST("/register", handlers.UserRegister)
|
|
|
|
userRoutes.POST("/login", handlers.UserLogin)
|
|
|
|
}
|
2024-08-03 07:16:55 +02:00
|
|
|
cardsRoutes := api.Group("/card")
|
|
|
|
{
|
|
|
|
cardsRoutes.GET("/:id", handlers.CardGetId)
|
|
|
|
cardsRoutes.POST("/add", handlers.CardGetId)
|
|
|
|
}
|
2024-08-02 17:14:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
|
|
|
|
2024-08-02 22:37:16 +02:00
|
|
|
go tokens.StartTokens()
|
2024-08-02 17:14:06 +02:00
|
|
|
r.Run(":3000")
|
|
|
|
}
|