Moving to API-First
In the previous chapters, we learned about building databases, adding monitoring to applications, using middleware, and session handling. In this chapter, we will learn about building an API in our application, and why an API is an important part of writing applications as it forms the interface between the frontend and the backend. Building the API first is important, as it forms the bridge for data exchanges and can be thought of as a contract between the frontend and the backend. Having the proper and correct form of contract is important before building an application.
We will also explore the concepts of REST and JSON to get a better understanding of what they are and how they are used throughout our application.
Upon completion of this chapter, you will know how to design a REST API using Gorilla Mux and also how to process requests to perform operations by converting data to and from JSON. You will also learn how to take care of error handling.
In...