This is a news web application that allows users to view news and search for news articles relating to a topic they are interested in. Additionally, every thirty seconds the page is updated to search for articles relating to the topic entered by the user to ensure they view the latest news.
This was built using
Here's the code sample of all news articles the user searched passed as a prop to be rendered onto the page
My approach to this was to view it as a website that retrieved news articles via a public API and displayed the main content of the articles for the users. This way I can focus purely on retrieving the news articles relevant to the users' searched topic and display them in a suitable manner. The website layout was designed this way to be simple and was inspired by other well-known news websites where they showed only the important information for the news articles such as name, title, description and image. If they wished to read more they would be able to click on it to view the full article on the same website however for my implementation if they wished to read more about the news article they would click on the article where they will be redirected to the actual article itself. This way it also provides credit to the website that published the article themselves.
The News API was used as it was free for up to 100 API calls every 24 hours. If I wish to make more API calls I can pay a fee or subscription which makes this web application scalable as well.
Additionally, in my code solution, I had the NEWS_API key be in a .env file which was included inside the .gitignore file so it wouldn't be pushed onto the repository. This provides a layer of security so that if the source code was accessed or viewed by someone who didn't have permission to it they won't be able to abuse the number of API calls as they would need their own API key.
Axios request with API key retrieved from .env file
What would you do to improve or extend your solution
While the current implementation fulfils the requirements, there are several future enhancements that could be made to improve my solution. Here are just a few possible enhancements:
In today’s world it can be difficult to filter through the news to find things you’re interested in.
We want you to build an application or service that allows users to enter a news topic they want to hear about. The application provides them with recent news stories about that topic, and updates them on new stories as they’re released.
They could view these stories on a webpage, or receive updates through email or another channel (and unsubscribe if they wish). Perhaps they can filter the news sources they wish to receive updates from. You can decide how users receive these news stories, and what they can do with it.
You can choose which programming languages and/or frameworks to use based on your expertise and chosen approach. Our advice is to complete this task in a way which shows your strengths.
Your submission should have 3 parts: