So in my last post I focused on how we can build a caching reverse proxy in Go Lang to allow us to cache the response of a slow server. The idea was that I could use this to speed up a website which rendered quite slowly on its server.
Today we are going to build this as a docker container image so that we can deploy it to a production system with relative ease.
To follow along with this blog post you will need to have downloaded Docker Desktop.
I had fun with my last application so when deciding what I wanted to work on next I wanted to work on something that would be just as much fun.
I also wanted something that would allow me to start experimenting with using 3rd party library's as well as be along the lines of something I might actually find a use for in the future. I therefore came up with the idea of building a caching reverse proxy. For those who haven’t come across reverse proxies before, Wikipedia sums it up as follows:
A HTTP/S reverse proxy can read and modify all traffic and IPs of web users going through it. In order to filter/cache/compress or otherwise modify the traffic.
https://en.wikipedia.org/wiki/Reverse_proxy …
You might have noticed I didn’t post for the past few days, this is because I have been focused on learning about a few new parts of Go Lang which I wanted to use together for a small Go Lang project.
The project in question is an API that returns random cat facts that are consumed from a 3rd party API. The idea behind this project was I could learn about how to integrate with a 3rd party API, parsing JSON, and random cat facts all at the same time.
To get started we will create our cat-facts.go
file for our application, with our basic go starter that we learned about on day 1. …
When I started to learn Go Lang on New Years Day my end goal was to be proficient enough in the language to be able to build web applications written in Go. In my first 5 days, I chose to focus on some of the fundamentals however today I have decided to set myself a small project.
The aim of the past two days has been being to build a web API that upon each request will respond with a random dessert.
In Go Lang, it is very easy to create a web server by using the net/http
library. To start with we import net/http
into our application, as seen on lines 3–5 below. The next step is to tell our application to listen for requests, we do this using the http.ListenAndServe. …
I started to learn Go Lang on New Year's day and I am documenting each day of my learning starting here on Medium. After taking a day's break from writing yesterday, today I want to focus on how to use loops in Go Lang.
Like in other languages you might have used, loops in Go Lang allow us to iterate over things such as numbers or datasets such as Arrays and Slices.
Below I have written a basic loop that will start with i
set to 1
and will then keep looping until i
is equal to 5
. …
I started to learn Go Lang on New Year's day and I am documenting each day of my learning starting here on Medium. So far I have setup my development environment, created my first ‘hello world’ application, and learned about Arrays. In today's post, I am going to learn about Slices in Go Lang and try and understand how they differ from Arrays.
When I was learning about Arrays in Go Lang yesterday I discovered that Arrays are fixed length. …
I started to learn Go Lang on New Year's day and I am documenting each day of my learning starting here on Medium. So far I have setup my development environment, created my first ‘hello world’ application, and made it take input using variables. In today's post, I am going to start with learning about how Arrays work in Go Lang.
Similar to other programming languages, Arrays in Go Lang allow you to store a collection of data. …
I started to learn Go Lang yesterday and documented my first day of learning here on Medium. In that first post I setup my development environment and created my first ‘hello world’ application. In today's post, I am going to start to learn about how variables work and start using conditional logic.
In Go, variables are explicitly declared and when you compile your application, Go will infer the type of the initialized variables and use this to check the type-correctness of your code.
To define a variable in Go Lang we use var
followed by the name of the variable, equals, and the value we want to assign to the variable. We can update our ‘Hello World’ application from earlier to use variables for each of the words. …
Recently I was given the feedback that I needed to broaden my skillset when it comes to the technologies I use to enable me to progress further in my career as an Engineer.
As a more ‘frontend focused’ full-stack engineer, the backend languages I have had experience with so far are those more commonly picked up by frontend engineers, that being PHP early on in my career and then later moving to Node.js.
I decided to pick Go Lang as a technology RVU already uses as the programming language to learn. …
My 2020 started like most peoples; I was going to work on the weekdays and enjoying my weekends with my family. Sometimes I would attend tech meetups after work. I even managed to host a couple in my workplace, first London Web Performance, and then on the last week before we entered lockdown, we hosted a JS Monthly London International Women’s Day event.
Then came lockdown, and with it came a sudden break in tech events, with conferences and meetups all being cancelled.
Shortly into this, I got talking to Natalie, an associate engineer I work with at RVU, and we came up with the idea of starting a meetup ourselves, we then found our another colleague Ricardo had similar ideas, so we combined forces. …
About