My first steps with Go, Carnitas and Mendelssohn

Hey there, it's been a while! I know, I say that every time =]

One of my goals for this year was to learn how to build web endpoints / REST APIs. From my experience in the Middleware team in Mind Candy, I was under the impression that the best / current way to do that was to use Scala. I had given it a go a few times, but I could never find a good tutorial that would help me understand handling routes, reading & writing to a database, and serving pages. It's hard to put all the pieces together without a good example to work off!

But a few days ago, an ex-colleague mentioned a language I had read about quite a lot in the last few year: Go. I looked it up and ended up finding a basic tutorial for Writing Web Applications. It looked easy enough to get me started, so I thought I'd adapt it to make my personal online bookmarking system (similar to, but hopefully, a bit less of a mess!)

With some help from other resources and tutorials, I was able to create my first REST endpoints, which was fairly easy. I spent most of the weekend improving, organising and refactoring my code.

I was able to create JSON endpoints to:

  • Get a list of all my bookmarks
  • Get details about a specific bookmark
  • Post a new bookmark
  • Post an update to an existing bookmark

I also coded a very ... minimalist (i.e. ugly) web page displaying all of my bookmarks. With that, I consider the very basic MVP done, but I already have a few ideas for what's coming next:

  • Implement a way to assign tags to bookmarks
  • Implement authentification and secure some of the APIs (possibly through JWT?)
  • Implement pagination on the API
  • Implement a pretty front-end to see the bookmarks
  • Add a way to add and edit bookmarks directly from the front-end
  • Make a simple Chrome extension to add bookmarks in one click

If I manage to do all of this, I think we can say that I've achieved all the stretch goals for this objective!

Apart from working on that, the highlights of the weekend were making carnitas from scratch (see above - slow-cooker for the win!) and going to see Prom 48 at the Royal Albert Hall, where we listened to Matthias Pintscher (Reflections on Narcissus) and Mendelssohn (A Midsummer Night's Dream - much more approachable than I expected, also: very funny!)

All in all a very good weekend! And the best part is that it's only a 4-day week for me, as I'm heading to Spain for a week on Friday, for my first holiday of the year!

Show Comments