https://www.youtube.com/watch?v=ma7rUS_vW9M&list=WL&index=3&t=1s
gorm gin bcrypt jwt godotenv CompileDeamon
go install github.com/githubnemo/CompileDaemon
compiledaemon --command="./go-jwt"
Add your application configuration to your .env file in the root of your project:
PORT=3000
Then in your Go app you can do something like
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
port := os.Getenv("PORT")
r := gin.Default()
r.GET("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "pong",
})
})
r.Run() // try load port from os.Getenv("PORT")
when import jwt package, remember to use v4 package.