One of Go’s greatest strengths lies in the its suitability for developing web applications. It offers great performance out of the box, is easy to deploy, and has many of the necessary tools you need to build and deploy a scalable web service in its standard library. This tutorial will walk you through a practical example of building a web application with Go and deploying it to production. It will cover the basics of using Go’s built-in HTTP server and templating language, and how to interact with external APIs. By Ayo.
The only requirement for this tutorial is that you have Go installed on your computer and that you are vaguely familiar with its syntax and constructs. The article then guides through:
- Prerequisites
- Downloading the starter files
- Creating a web server
- Reading variables from the environment
- Getting started with templating in Go
- Automatically restarting the server
- Serving static files
- Creating the search route
- Creating the News API client
… and more. In this article, we successfully created a News app and learnt the basics of using Go for web development along the way. We also covered how to deploy the finished application to Heroku. Nice one!
[Read More]