0
Fork 0
mirror of https://codeberg.org/SafeTwitch/safetwitch-backend.git synced 2024-12-23 05:32:59 -05:00
safetwitch-backend/routes/api/discover/discover.go
2023-07-19 20:27:36 -04:00

32 lines
662 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)
return
}
context.JSON(200, extractor.FormatMessage(data, true))
})
}