Go Runs My Blog

Wednesday, October 11, 2017 21:02:00 (CT)

A few days ago, I decided that I wanted to create my own blog. Not because I wanted anybody to read it, just because I wanted to work with some web technologies and see how the pieces fit together. Of course, there are plenty of cookie cutter solutions out there to achieve this end, but that isn’t why I wanted to create a blog so I took a different approach.

The first thing that I needed to decide was how I would serve my content. Maybe I would create a database to store my entries, query that data, then serve it to the browser. This seemed like a logical start, but, at the same time, it felt a bit heavy for a starting point. Why not get started by writing a lightweight server that would serve static HTML from the file system.

This felt like a much better starting point. Now, all I needed was something that I could get up and running quickly and, with my favorite language being Go, Go seemed like a logical choice. It turns out that with Go’s net/http package this is extraordinarily simple.

That’s all there is to it, well technically we add a little static HTML and a little CSS to style it and presto, blog created.