Recently, Digital Ocean announced they’re entering the PaaS market with their new application platform. They’ve hosted virtual machines (droplets) and Kubernetes based services for years, but now they’re creating a platform that’s a simple point and click to get an application up and running.

So I decided to try it. In this tutorial, we’re going to build an application on that platform. I will use Go to make a small web API and have it backed by a SQLite database. I’ll show you the steps required, and we’ll see just how easy it is (or isn’t) to deploy applications on the platform.

We’ll create a small service that:

  • Takes a city name as input
  • searches against a database
  • Returns ZIP code and other information for that city

If you want to follow along with this tutorial, here’s what you’ll need:

DB Browser for SQL Lite

Download this CSV

Creating Your Repository

The first thing we’ll need to do is create a repository on GitHub. The Digital Ocean app platform uses your repos to pull code from and builds from there.

Now, clone the Digital Ocean sample repository to another folder:

Now, you can fork this. However, since we’re not going to be contributing changes back to that repo, and we don’t want to pull changes from it, it’s essentially a new project. So I’m just going to copy the files from that repo into mine.

Now I have the sample code in my own repo:

Cool, now let’s push it up to Github.

git add .
git commmit -m "Initial Commit"
git push origin main

Now the sample project is available on my Github, where I can connect to it.

#programming #api #golang #golang-api #api-development #go #build-a-go-web-api #digital-ocean

Build a Go Web API with the New Digital Ocean App Platform: A How-To Guide
6.10 GEEK