| 12345678910111213141516171819202122232425262728293031323334 |
- // API doc: https://wiki.summercamp.local/display/PIN/Pinguin+server+API
- package main
- import (
- "log"
- "math/rand"
- "net/http"
- "os"
- "time"
- extStomp "github.com/go-stomp/stomp"
- "battlecamp-go-server/games"
- "battlecamp-go-server/stomp"
- )
- var currentGames games.GameServer = games.New()
- var stompConnection *extStomp.Conn
- func main() {
- logFile, err := os.OpenFile("server.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
- if err == nil {
- log.SetOutput(logFile)
- } else {
- log.Println("ERROR: Cannot open log file, using console.")
- log.Printf("%v=n", err)
- }
- rand.Seed(time.Now().UnixNano())
- stompConnection = stomp.DailStomp()
- defer stompConnection.Disconnect()
- log.Fatal(http.ListenAndServe(":8080", newUrlRouter()))
- }
|