Before we wrap up this chapter, let's quickly test that everything is configured correctly. A feature we'll most likely need later on is a users feature, so let's create a Features/Users/UsersController.cs file, and fill it in with the following contents:
namespace ECommerce.Features.Users
{
[Route("api/[controller]")]
public class UsersController : Controller
{
private readonly EcommerceContext _db;
public UsersController(EcommerceContext db)
{
_db = db;
}
[HttpGet]
public async Task<IActionResult> Get()
{
return Ok(await _db.Users.ToListAsync());
}
}
}
This is all we need to test the completed setup, so run the application again now and navigate to http://localhost:5000/api/users in your web browser. You should be presented with a...