In HTTP protocol, client anyway has to wait till server process the request and return HTML/JSON. What is significant/different between Async and sync operation? I mean there is no GUI which may freeze if sync operation used.
Async method
[HttpGet]
[Route("{id}")]
public async Task<ActionResult<Employee>> GetByID(int id)
{
return await _employeeRepo.GetAsyncByID(id);
}
Sync method
[HttpGet]
[Route("{id}")]
public ActionResult<Employee> GetByID(int id)
{
return _employeeRepo.GetByID(id);
}
Async will not freeze the main thread but then how does it make any difference when there is no UI