Files
Hightube/backend/cmd/server/main.go
2026-04-09 00:14:57 +08:00

38 lines
870 B
Go

package main
import (
"hightube/internal/api"
"hightube/internal/chat"
"hightube/internal/db"
"hightube/internal/monitor"
"hightube/internal/stream"
)
func main() {
monitor.Init(2000)
monitor.Infof("Starting Hightube Server v1.0.0-Beta3.7")
// Initialize Database and run auto-migrations
db.InitDB()
// Initialize Chat WebSocket Hub
chat.InitChat()
srv := stream.NewRTMPServer()
// Start the API server in a goroutine so it doesn't block the RTMP server
go func() {
r := api.SetupRouter(srv)
monitor.Infof("API server listening on :8080")
if err := r.Run(":8080"); err != nil {
monitor.Errorf("Failed to start API server: %v", err)
}
}()
// Setup and start the RTMP server
monitor.Infof("Ready to receive RTMP streams from OBS")
if err := srv.Start(":1935"); err != nil {
monitor.Errorf("Failed to start RTMP server: %v", err)
}
}