Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for HTTPs in dev and production via nginx #262

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ func getLobby(w http.ResponseWriter, r *http.Request) {
func main() {
rand.Seed(time.Now().UTC().UnixNano())

PORT := os.Getenv("PORT")
brian-nguyen marked this conversation as resolved.
Show resolved Hide resolved
if PORT == "" {
PORT = "9090"
}

arena.MessageChannel = make(chan models.Message)
game := game.CreateGame()

// database.ConnectDB("service-account.json")
// if database.DBC == nil {
// log.Println("DBClient not initialized correctly")
// }

http.Handle("/", http.FileServer(http.Dir("./build")))
http.HandleFunc("/start", getLobby)
http.Handle("/connect", game)
game.StartGame()

log.Println("Starting server on localhost:" + os.Getenv("PORT"))
log.Println(http.ListenAndServe(":"+os.Getenv("PORT"), nil))
log.Println("Starting server on localhost:" + PORT)
log.Println(http.ListenAndServe(":"+PORT, nil))
}