dotnet.microsoft com code example
Example 1: dotnet.com
curl https://localhost:5001/people/all
[{"name":"Ana"},{"name":"Felipe"},{"name":"Emillia"}]
Example 2: dotnet.com
[ApiController]
public class PeopleController : ControllerBase
{
[HttpGet("people/all")]
public ActionResult<IEnumerable<Person>> GetAll()
{
return new []
{
new Person { Name = "Ana" },
new Person { Name = "Felipe" },
new Person { Name = "Emillia" }
};
}
}
public class Person
{
public string Name { get; set; }
}