We have left off part 2 by creating the blog apis. In this article we will design the User struct and implement User authentication. We will be using JWT token for authentication. Do make sure you have gone through Part 2 and Part 1. Note : All codes...
uchaudhary.hashnode.dev6 min read
Hi Umesh, how to protect route with jwt? can you explain it at next part?
I mean, using the gin Context in controller, how to bind the model with association.
c.ShouldBindJSON(&product);
Hi Umesh,
Thanks for the nice blog post. May I check with you how would you bind the model that has association to another models.
I'm trying to follow your post, but facing challenge at this point. Appreciate your feedback on this.
type Product struct {
gorm.Model
Name string `gorm:"type:varchar(50)"`
Description string
CountryID uint
Country Country
ProductGroupID uint
ProductGroup ProductGroup
Website string
}
type ProductGroup struct {
gorm.Model
Name string `gorm:"type:varchar(50)"`
Description string
}
Mehrdad Dolatkhah
WOW, Great. I'll wait for your next part. thank you