diff --git a/main.go b/main.go index 030b540..f333182 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,7 @@ import ( "log" "math/rand" "net/http" + "os" "strings" "time" @@ -115,7 +116,6 @@ func main() { "code": 200, "message": "DeepL Free API, Made by sjlleo and missuo. Go to /translate with POST. http://github.com/OwO-Network/DeepLX", }) - }) r.POST("/translate", func(c *gin.Context) { @@ -225,5 +225,11 @@ func main() { } } }) - r.Run(":1188") // listen and serve on 0.0.0.0:1188 + + port, ok := os.LookupEnv("PORT") + if ok { + r.Run(":" + port) + } else { + r.Run(":1188") // listen and serve on 0.0.0.0:1188 + } }