Start.go 589 B

123456789101112131415161718192021222324
  1. package server
  2. import (
  3. "log"
  4. "net/http"
  5. "strconv"
  6. )
  7. // Start the HTTP and WebSocket server
  8. func (server *Server) Start() {
  9. // Declare ourselves up and running to the console.
  10. log.Println("Started sudoku-funpark server")
  11. // Run the agent manager
  12. // go server.agentManager()
  13. // Start the http server
  14. http.HandleFunc("GET /json", server.jsonDumper)
  15. http.HandleFunc("POST /addTask", server.addTask)
  16. // Start the websocket server
  17. http.HandleFunc("/ws", server.handleConnections)
  18. log.Fatal(http.ListenAndServe(server.ListenAddress+":"+strconv.Itoa(server.ListenPort), nil))
  19. }