package server

import (
	"log"
	"net/http"
	"strconv"
)

// Start the HTTP and WebSocket server
func (server *Server) Start() {
	// Declare ourselves up and running to the console.
	log.Println("Started sudoku-funpark server")

	// Start the http server
	http.HandleFunc("/json", server.jsonDumper)

	// Start the websocket server
	http.HandleFunc("/ws", server.handleConnections)
	log.Fatal(http.ListenAndServe(server.ListenAddress+":"+strconv.Itoa(server.ListenPort), nil))
}
