0
Fork 0
mirror of https://codeberg.org/SafeTwitch/safetwitch-backend.git synced 2024-12-22 21:23:01 -05:00
safetwitch-backend/routes/root/root.go

22 lines
449 B
Go
Raw Normal View History

2023-05-25 20:04:15 -05:00
package root
import (
"safetwitch-backend/extractor"
"safetwitch-backend/extractor/chat"
2023-05-25 20:04:15 -05:00
"github.com/gin-gonic/gin"
)
func Routes(route *gin.Engine) {
auth := route.Group("/")
auth.GET("/", func(context *gin.Context) {
upgradeHeader := context.Request.Header.Get("Upgrade")
if upgradeHeader == "websocket" {
chat.ServeWS(context)
} else {
context.JSON(200, extractor.FormatMessage("SafeTwitch backend running", true))
}
2023-05-25 20:04:15 -05:00
})
}