January 20, 2020

Writing RESTful APIs in Go, 3 years later

I’ve started working with Go in early 2017, and since then most of my work has been writing RESTful APIs with it. With time I gained experience. and I constantly change the way I write APIs in Go. After a year of working with Go, I’ve released Gorsk - a Golang RESTful starter kit, and an update to it 6 months later. I get many emails and questions on how to use it properly, which means that something like Gorsk is highly needed. Over time I’d like to keep it up-to-date with my latest views on how to write REST APIs in Go, and this blog post serves as a first step in the next iteration. Read more

January 1, 2020

A Year in Review - 2019

I never felt confident writing my ‘year in review’ until this year. I felt that I haven’t much to share, and even if I had I thought it wasn’t interesting. After reading a few similar posts from other bloggers, and having quite an interesting year, I thought that this year would be good to start with. Read more

October 10, 2019

dt - Go's missing datetime package

Go’s standard library contains a single date package - time. The type provided by it, Time, contains date, time and location information. More often than not we don’t need location info, or we need to represent date/time only. dt provides exactly that, a time-zone-independent representation of time that follows the rules of the proleptic Gregorian calendar with exactly 24-hour days, 60-minute hours, and 60-second minutes. Read more

October 4, 2019

Working with enums in Go

Enums (short of enumerators), identifiers that behave like constants, are useful parts of many languages. Unfortunately, enums in Go aren’t as useful due to Go’s implementation. The biggest drawback is that they aren’t strictly typed, thus you have to manually validate them. Read more

July 16, 2019

Building a Cloud Function that generates PDFs from provided URL

At my current company, we generate PDF reports for our customers that contains detailed statistics for checks done on a car. We did so by generating an HTML using Go Templating engine, then using Headless chrome inside docker container to generate PDF from HTML. Since we’re running on App Engine, we had to use Flex environment in order to support custom docker image, which resulted in higher cost and significantly slower deployment times. To move the service to standard environment, I rewrote the PDF generation to a Cloud Function. Read more

July 10, 2019

Building a live chat with Go, NATS, Redis and Websockets

Building a live-chat server is a good practice for learning a ‘backend’ programming language. You need to provide an uninterrupted stream of data (think WebSockets), message storer and ideally a pubsub mechanism to send a message to all subscribed consumers. Goch is no different, besides HTTP and REST endpoint it uses WebSockets, Redis, and NATS-streaming to support live-chat messaging. Read how it runs and how you can build your own live-chat in Go. Read more

June 6, 2019

Deploying GoBuffalo app using Dokku

Last few months I spent my free time building Confello - a tech conference aggregator. You can read more about it HERE. I built it with GoBuffalo, a Go Web Framework. At first, I deployed the website on Heroku using the provided buffalo-heroku plugin. Before launching, I wanted to optimize the website on reverse proxy (gzip, expire headers …). Since Heroku doesn’t provide access to reverse proxy (Nginx), I looked for another solution. I found Dokku - which turned out to be great and easy to work with. Read more

May 30, 2019

Launching Confello

Last few months I spent some of my free time working on a project I felt was missing in the tech space. I’m proud to announce that today we’re making Confello, a tech conference aggregator website, available for public. Find, browse and discuss your favorite tech Conferences at Confello! Read more

January 28, 2019

Google Datastore with a relational data model

I’ve been working on a medium-sized European software as service (SaaS) for the last two years. Almost everything we use comes from Google, which includes Cloud Datastore as our primary source of truth. I’m not advocating against it - depending on your use-case it might be a great fit. Instead, I’m presenting the issues we have with it (and other NoSQL/document databases) due to our domain models being very relational. Read more

December 10, 2018

Why you should start blogging

There are plenty of good reasons why you should start blogging right now or at least consider doing it. I’ve blogged previously about a decade ago and started doing it again since last year. I’ve seen plenty of benefits from this blog (and the previous one) and will talk about them in this blog post. In the end, I will propose a few modern solutions needed for starting your own blog. Read more

October 28, 2018

Refactoring Gorsk - Why and how

Refactoring source code should be a constant process in software’s lifecycle. I advocate for 20-25% of time spent on developing software to be used on refactoring exclusively. After working with Gorsk in two projects running now in production (one of them being a large SaaS), I’ve found many things I don’t like about it. During the development of those projects I refactored some things, but I decided the base needs to be updated too. Read more

September 15, 2018

Beyond REST

I’ve been dealing with RESTful services for the last three years, both professionally and for hobby projects. Since I came from SOAP/XML/Oracle background, REST felt so great and modern. Even though I felt late to the party, I think I didn’t lose that much. However, with the advancement of Cloud Native projects, I feel like I’m getting behind modern tools and technologies. And I want to change that. Read more

August 30, 2018

Marshal YAML fields into map[string]string

Recently we moved some of our hard-coded web-app configuration values into a YAML file. Arguing aside (YAML vs TOML vs …), YAML does a great job being easily readable by us - humans. By default, the yaml library marshals maps into map[string]interface{}, requiring a small change to get it marshaled into map[string]string. Read more

August 16, 2018

Twisk - Golang RPC starter kit

Twisk, an acronym for Twirp starter kit, helps you get started with a simple Golang RPC framework with protobuf service definitions - Twirp. It features everything from authorization, implemented CRUD on a single entity, logging, configuration and more. Using minimal dependencies, idiomatic code and best practices, it helps you get started with Golang backend API development - both JSON and Protobuf. Read more

June 10, 2018

Serve SwaggerUI within your Golang application

I’ve previously written an Article on generating OpenAPI (Swagger) spec automatically within Golang. It’s the most popular article on this blog since lots of developers are searching for it. In it, I mentioned that in order to serve the swagger.json with SwaggerUI, a Docker instance is required that will serve SwaggerUI. There is an easier way to implement it, and this article will demonstrate how to do it with net/http, Gin and Echo. Read more

2024 © Emir Ribic - Some rights reserved; please attribute properly and link back. Code snippets are MIT Licensed

Powered by Hugo & Kiss.