public async Task <IActionResult> Gethosts( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "hosts")] HttpRequest req, ILogger log) { try { log.LogInformation("Get hosts function called"); List <Host> hosts = await _hostService.Get(); return((ActionResult) new OkObjectResult(hosts)); } catch (Exception ex) { var error = $"Get hosts failed: {ex.Message}"; log.LogError(error); return(new BadRequestObjectResult(error)); } }