Implementing a solution to find the top 5 Ice Cream Shops in Alpharetta, also getting a review of each one.
In this implementation an API was developed using the stack Node.js, Express and Jest to perform the application tests.
A create-react-app was also developed to show the API results.
In the backend folder, execute the following commands:
If you have yarn installed:
yarn
Or if you prefer to use npm:
npm install
Then go to the frontend folder and run the same command.
This will install all the necessary dependencies to run the applications.
To start the applications, open two terminals, one in the frontend folder and another in the backend folder and run the command yarn start or npm start on each terminal.
Access the implementation at http://localhost:3333.
GET /businesses
Search and return the businesses.
Parameters
limit: Optional parameter that limits the amount of results returned. The default value is 5 and the maximum is 50.
Responses
200 OK
Success in searching and returning the businesses. Returns a businesses array.
400 BAD REQUEST
Error getting the businesses.
GET /reviews/{businessId}
Returns the reviews of a business.
Parameters
limit: Optional parameter that limits the amount of results returned. The default value is all reviews of the business.
Responses
200 OK
Success in searching and returning the businesses. Returns a businesses array.
400 BAD REQUEST
Error getting the reviews of the business.
Access the implementation at http://localhost:3000.
This page contains a BusinessesList component that does a request to /businesses using 5 as the limit of the businesses.
Each business in BusinessesList is a BusinessesBox component that contains the business information and a Review component.
Review component receive the business data and does a request to /reviews/{businessId] using 1 as the limit of the reviews.
Also was developed two components BusinessPlaceholder and ReviewPlaceholder that are shown while the API doesn't return the information.