This project fetches and displays restaurant data from the Just Eat API based on a given UK postcode. It focuses on displaying restaurant information, such as name, cuisines, rating, and address. The data is displayed in a simple web interface using React.
- Make sure you have the following installed on your machine:
Node.js
npm
- this can be checked by running the following commands
node -v
npm -vIf Node.js and npm are not installed downlaod here, (https://nodejs.org/en).
- Clone the Repository
First, clone the repository to your local machine:
git clone git@github.com:your-username/Jet-app.git- Install Dependencies
Navigate into the project directory and install the required dependencies:
npm install- Start the Proxy Sever
Before starting the application, ensure you have the proxy server running. In a separate terminal window, navigate to the project directory and run the following command:
node server.js- Start the Application
Once the proxy server is running, you can start the development server with the following command:
npm start-
I assumed that the structure of the API response would remain consistent, specifically that the data.restaurants array would always be present, and that the fields name, cuisines, rating, and address would exist for each restaurant.
-
I assumed that the requirement to display only 10 restaurants meant limiting the display to the first 10 results provided by the API, regardless of any specific ordering or filtering criteria.
-
The app previously relied on a CORS proxy (cors-anywhere) to bypass CORS restrictions when making API requests. However, this is no longer necessary as I have implemnet a proxy server (server.js) to handle requests and avoid CORS issues.
-
Currently, the application does not validate the user-provided postcode before making the API request. An improvement would be to add postcode validation to ensure that only valid postcodes trigger API requests. This would prevent unnecessary requests to the API with incorrect or incomplete postcodes, enhancing the user experience and preventing potential errors.
-
Instead of simply slicing the first 10 results, apply filtering based on API fields—such as star rating, delivery cost, open-now status or cuisine type—to surface more relevant listings.
-
The UI is functional but can be improved for a more engaging experience.