Not too long ago I wrote an article regarding how to create a RESTful API using the Go programming language, but in it I only used mock data rather than an actual database. What happens if we want to use a database with GoLang? What database, or more importantly, what kind of database should be used? Most APIs transfer data in JSON format, so it might make sense to store data in the same format. This means that a relational database might not make sense. Instead, NoSQL databases fit quite well when it comes to RESTful APIs. A popular NoSQL database that stores data in JSON format is the open source Couchbase Server.
We’re going to take a look at how to include Couchbase Server into our RESTful web application written in the Go programming language.