Basic ASP.NET Core REST API?
[ApiController]
[Route("api/[controller]")]
public class EmployeeController : ControllerBase
{
[HttpGet("{id}")]
public IActionResult Get(int id)
{
return Ok(new { Id = id, Name = "Sandeep" });
}
}
Key Characteristics:
- Lightweight
- JSON support by default
- Built-in dependency injection