dynamic port

This commit is contained in:
Tommy Parnell
2021-12-28 11:42:40 -05:00
parent 76930490d6
commit 6468c8c180

View File

@@ -1,6 +1,8 @@
package main
import (
"os"
"github.com/TerribleDev/fiber-test/people"
"github.com/gofiber/fiber/v2"
)
@@ -15,6 +17,10 @@ func main() {
}
return c.JSON(person)
})
port := os.Getenv("PORT")
if port == "" {
port = ":3000"
}
app.Listen(":3000")
app.Listen(port)
}