Summary
In this chapter, we learned how to build a RESTful API that leverages the Gin framework and Go driver for creating queries and querying in a NoSQL database such as MongoDB.
We also explored how to speed up the API by caching the data it accesses with Redis. It is definitely a great addition to your application if your data is mostly static and does not change constantly. Finally, we covered how to run performance benchmarks with Apache Benchmark.
The RESTful API we have built so far works like a charm and is open to the public (if deployed on a remote server). If you leave the API unauthenticated, then anybody can hit any endpoint, which may very undesirable as your data could be damaged by users. Even worse, you might expose sensitive information from your database to the whole internet. That's why, in the next chapter, we will cover how to secure the API with authentication, such as JWT.