//[NoCache] //[ProducesResponseType(typeof(List<Story>), 200)] // [ProducesResponseType(typeof(ApiResponse), 400)] public async Task <ActionResult> NewStories(string searchTerm) { try { var newStories = await _hackerNewsService.GetNewStoriesAsync(searchTerm); return(Ok(newStories)); } catch (Exception) //ex) { // _logger.LogError(ex.Message); return(BadRequest(new ApiResponse { Status = false })); } }
public async Task <ActionResult> NewStories() { try { var newStories = await _hackerNewsService.GetNewStoriesAsync(); return(Ok(newStories)); } catch (Exception ex) { _logger.LogError(ex.Message); return(BadRequest(new ApiResponse { Status = false, ErrorMessage = $"Could not load hacker news feed" })); } }
public async Task <ActionResult> NewStories(string searchTerm) { Console.WriteLine("new stories", searchTerm); try { var newStories = await _hackerNewsService.GetNewStoriesAsync(searchTerm); return(Ok(newStories)); } catch (Exception) //ex) { // _logger.LogError(ex.Message); return(BadRequest(new ApiResponse { Status = false, ErrorMessage = $"Could not load hacker news feed" })); } }