2024/11/07 14:28:26 Error loading env file

I was deploying by backend written in go gin gonic but every time it is showing cant read env file I have added the env variables in dashboard even but still error persists
package main

import (
“log”
“net/http”
“os”
“server/routes”

"github.com/gin-gonic/gin"

)

func main() {
gin.SetMode(gin.ReleaseMode)

port := os.Getenv("PORT")

if port == "" {
	port = "10000"
}
router := gin.Default()
router.Use(gin.Logger())
router.Use(CORSMiddleware())
routes.AuthRoutes(router)
routes.DataRoutes(router)
router.GET("/working", working)
if err := router.Run(":" + port); err != nil {
	log.Panicf("error: %s", err)
}

}

Hi,

Please could your share the logs/errors you’re seeing? They will likely point to errors better than code snippets.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.