Several people have been talking about Go for a while. I’ve never felt the need to learn it, but today one video caught my attention. A sudden wave of FOMO caught me, and I decided to try and learn both Go and Rust via a quick project.
Considering how much the health world inspires me — and yes, I’ll still be working on Healti in the future — I thought it would be nice to build a health-related API to just get my hands dirty with these technologies.
As you can imagine by reading the title, I started with Go. Go is praised as an easy-to-read language, with strong concurrency support, and of course static typing. Its syntax looks a bit different compared to the other popular languages in my opinion, but I agree on its readability. Not knowing lower level languages like C/C++, I didn’t find the pointer notations and operators that straightforward, but still kind of easy to catch up on.
That said, I had the pleasure to use some of the integrated modules from the (rich) standard library, GORM to interact with the database, Gin as the backend framework, Gorilla for the WebSocket implementation, and GoDotEnv for environment variables management.
As of now, these are the features the project has:
- user registration and authentication
- health-related journaling
- exercise and nutrition logging (to be added)
- WebSocket-based reminders (to be completed)
While, since it is a backend project, these are the available endpoints:
/register
,/login
(for registration and authentication)/journal
,/journal/entries
,journal/:id
(for journaling operations)/exercise/entries
,/exercise/:id
(for exercise logging, to be added)/nutrition/entries
,/nutrition/:id
(for nutrition logging, to be added)/reminders
,/reminder/:id
(for reminders, to be added)
You can check out the complete code at github.com/vtfrc/go-health.
While this is just a quick experiment, I’ll add the remaining pieces. Then I’ll move on to the Rust version, which I’m going to write about as well.