Skip to content

Commit

Permalink
make port configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
JLarky committed Apr 23, 2024
1 parent 00e6734 commit 853fe72
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/strike/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ package main
import (
"fmt"
"net/http"
"os"

"github.com/JLarky/strike/internal/routes"
)

func main() {
port := os.Getenv("PORT")
if port == "" {
port = "3333"
}

r := routes.NewRouter()

fmt.Println("Server starting on http://localhost:3333")
http.ListenAndServe(":3333", r)
fmt.Printf("Server starting on http://localhost:%s\n", port)
http.ListenAndServe(":"+port, r)
}

0 comments on commit 853fe72

Please sign in to comment.