Handling requests
To handle incoming requests, we first need a set of minimal API endpoints for those requests to be sent to. Let’s recap what we explored in Chapter 2, around creating minimal API endpoints with varying HTTP methods (GET, POST, PUT, DELETE, and PATCH). We can refresh our memories by creating some static mock data that will represent the task entities our API is handling. Then, we can define some simple endpoints that manipulate or query that data.
Let’s create the mock data first. We’ll do this by creating a simple TodoItem class, and a static list for instances of this class to reside in:
public class TodoItem
{
public int Id { get; set; }
public DateTime StartDate { get; set; }
public DateTime DueDate { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public...