GoTomato/cmd/server/main.go

27 lines
584 B
Go
Raw Normal View History

package server
import (
"fmt"
"git.smsvc.net/pomodoro/GoTomato/internal/websocket"
"git.smsvc.net/pomodoro/GoTomato/pkg/models"
"log"
"net/http"
)
var serverConfig = models.GoTomatoServerConfig{
ListenAddress: "0.0.0.0",
ListenPort: 8080,
}
func Start() {
listen := fmt.Sprintf("%s:%d", serverConfig.ListenAddress, serverConfig.ListenPort)
http.HandleFunc("/ws", websocket.HandleConnections)
log.Printf("Pomodoro WebSocket server started on %s\n", listen)
err := http.ListenAndServe(listen, nil)
if err != nil {
log.Fatalf("Error starting server: %v", err)
}
}