After a lot of time spent building golang API's in my job and getting a lot of experience in this wonderful language, i think it's time to share some of this experience with the community that has helped me so much in this journey. This post will be the first of a from zero to hero series on how to build a complete REST API in golang.
I will show you how to build a simple CRUD. But you need to know others things that are necessary to take your project to another level, like to unify your error handling, provide a documentation with swagger, project logging and how to send those logs to a log center (ELK, Splunk, etc), produce a simple repository layer with GORM, use migrations to version your database scripts. I will show you all that and also how I normally structure my projects.
If you search for the tools that I used in this project individually you can find many tutorials online, including how to use they in golang of course, but I could not find any tutorial teaching how to use all of them to provide a complete project, of course you will see something like that in a paid course but I think that it's time to share this information completely free.
Please, feel free to share your opinion in the next posts, it may help me or other people. Or contact me directly.