0
Fork 0
mirror of https://codeberg.org/SafeTwitch/safetwitch-backend.git synced 2025-01-08 22:00:24 -05:00
safetwitch-backend/routes/api/discover/discover.go
2023-06-07 12:25:52 -04:00

31 lines
652 B
Go

package discover
import (
"github.com/gin-gonic/gin"
"safetwitch-backend/extractor"
"safetwitch-backend/extractor/twitch"
)
func Routes(route *gin.Engine) {
auth := route.Group("/api/discover")
auth.GET("", func(context *gin.Context) {
data, err := twitch.GetDiscoveryPage(50, "")
if err != nil {
context.Error(err)
return
}
context.JSON(200, extractor.FormatMessage(data, true))
})
auth.GET("/:categoryName", func(context *gin.Context) {
data, err := twitch.GetDiscoveryItem(context.Param("categoryName"), 50, "")
if err != nil {
context.Error(err)
}
context.JSON(200, extractor.FormatMessage(data, true))
})
}