Building a web page from scratch can feel like something complicated and time-consuming. It sure can, unless we are able to split our work into multiple smaller steps by extending the functionality with every iteration. Let's take a trip with Go Buffalo framework and build a business-card website with baby steps.
When serving web applications from your own server (or a dedicated instance in the cloud) you might want to allow an access to the users from all around the world. Giving out an IP address does not look very professional so you choose to have an awesome domain. What if you have multiple domains, though? Let's configure nginx server so that you don't have to pay extra and have everything in the same place.
Most of the applications we build need some kind of configuration that can alter its behavior. The level of logging, HTTP to run the server on, database credentials - you name it. While you can ship your app with YAML file, thanks to Docker (among others) it's more popular to use environmental variables. How exactly do we do it, though? Let's see what are our options.
Building a framework in Go is not an easy thing to do. It has little to do with the language itself, rather it's about the community approach to frameworks in general. We are about people who spend half of their time writing "if error is not nil" checks. Despite all that, a man by the name of Mark Bates chose this path and decided to create something that might revolutionize web development in Go. Let's dive into GoBuffalo, one of the most hyped Go-related things.
When saving data to an SQL database, we often use some kind of autogenerated primary keys for our entities. It's very handy since we don't need to keep track of it and make sure we don't have duplicate identifiers. On the other hand, when inserting data we are not sure how we can retrieve it, as it wasn't chosen by us. Actually, using PostgreSQL it is very easy to achieve, so let's take a look how we can do that in a Golang application.
Today I would like to share one of the simplest developer lifehacks I came up with, yet the one that saved me a ton of time since I started using it. In fact, it's been used without me having to do anything more than just set it up.
We've taken a look at the ways to represent OOP inheritance in an SQL database: single table, multiple tables, and a reference table. We were using PostgreSQL for those examples, and this database allows us to use one more way of representing such a relation. Let's take a look on PostgreSQL's INHERITS.
When building our applications, we often try to identify some problem and transform it into a programming language by creating appropriate data structures and relations between them. Then, when we want to store that data in an SQL database, things sometimes get tricky. In this post, I want to show three ways we can represent real-life inheritance in an SQL database.
Exposing gRPC server in a form of HTTP API is pretty easy using grpc-gateway, but when it comes to returning errors, the default behavior is something that might be bothering us. Let's see how can we improve that.
Have you ever noticed your web application working a bit slower than you expected? Or maybe it looks OK, but some client complains that it's slow for them? If you don't monitor your app, it's virtually impossible to verify if this is true. That's why you should use Prometheus to find out.