A Simple TODO Application
Let’s implement a TODO application by following the test-driven development approach. This application will be a REST API that exposes actions for:
id
.The data returned from the REST API must be in JSON format. The layout of the application will be made up of these packages:
handlers
package that contains the HTTP handler we’ll definedb
package that contains the code to access the database.models
package that contains the TODO struct definition.This project assumes that you’re very familiar with HTTP concepts. If you don’t feel comfortable with them, you can find everything you need in the “Test Web API” lesson of the course.
This project is meant to be a simplification of real-world programs. Its purpose is to demonstrate how we can apply TDD in our daily work. It isn’t supposed to provide you with guidelines on how to develop real applications. For example, the project doesn’t check for the Content-Type
header or the Status Code returned by HTTP Responses which is mandatory in a real application. Furthermore, it’s very unlikely to only implement actions for reading data. It’s pretty common to have to also implement the actions for creating, editing, and deleting resources.