mirror of
https://codeberg.org/SafeTwitch/safetwitch-backend.git
synced 2024-12-22 05:02:58 -05:00
21 lines
448 B
Go
21 lines
448 B
Go
package root
|
|
|
|
import (
|
|
"safetwitch-backend/extractor"
|
|
"safetwitch-backend/extractor/chat"
|
|
|
|
"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))
|
|
}
|
|
})
|
|
}
|