fix: add default port

This commit is contained in:
axolotlmaid 2024-09-25 21:37:26 +01:00
parent 022e5f6c62
commit 5c10dc7684

View file

@ -33,6 +33,11 @@ func NewRouter() {
r.Get("/currently-playing", handler.HandleGetCurrentlyPlaying)
slog.Info("Starting server", slog.Any("port", os.Getenv("PORT")))
http.ListenAndServe(":"+os.Getenv("PORT"), r)
port := os.Getenv("PORT")
if len(port) == 0 {
port = "8080"
}
slog.Info("Starting server", slog.Any("port", port))
http.ListenAndServe(":"+port, r)
}