This is a Restaurant Reviewer application built using Angular 2 for frontend and REST APIs in Node.js(using Express) for backend. It lets the users search for restaurants near their location, read the reviews for the restaurants and submit reviews for the same.
The app uses Yelp Business Search V3 API to load real time data for restaurants at a particular location.
The users can enter their location and click "Search" to load the list of restaurants (sorted by distance) The restaurant tile shows the Restaurant Name, Address and Category for the restaurant.
Opens up when you click on a restaurant tile on home page. "Back" button navigates you back to the home page.
Clicking on "Submit" saves the review.
- The app is based upon REST APIs built using Node.js and Express.
- Mongoose is used to connect to the database.
- The database only stores the reviews, the restaurant data is loaded in real-time by making API calls to Yelp.
- API routes have been defined to search for restaurants, get details of a particular restaurant. These APIs do not interact with the database.
- API routes for GET, POST, DELETE a review interact with the Yelp APIs as well as the database.
- The frontend has been built using Angular 2.
- HTML embedded in Typescript is used to load web pages.
- A data service has been written which interacts with the backend REST APIs.
Clone the repo:
git clone [email protected]:karanbhomiagit/restaurant-reviewer-app
cd restaurant-reviewer-app
Install node modules:
npm install
Set environment (vars):
cp /env/development.json.reference env/development.json
Start the server:
NODE_ENV=development npm start
Tests:
# Run tests
make test
# Run test along with code coverage
npm run coverage
Travis CI has already been integrated. The build is triggered at git commit/push.
- Download the heroku-cli
- Clone : https://github.com/heroku/node-js-getting-started.git
- Create, deploy and open a Heroku app. (heroku create, git push heroku master, heroku open)
- Define a procfile. (web: npm start)
- Run the app locally. (heroku local web)
- Push local changes.
- Add a database to your app. (heroku addons:create heroku-postgresql:hobby-dev)
Universal logging library winston is used for logging. It has support for multiple transports. A transport is essentially a storage device for your logs. Each instance of a winston logger can have multiple transports configured at different levels. For example, one may want error logs to be stored in a persistent remote location (like a database), but all logs output to the console or a local file. We just log to the console for simplicity, you can configure more transports as per your requirement.
- Login feature - Maintaining session using redis. Also, add token based authentication to the REST API.
- Editing an already submitted review.
- Allow only 1 review per login/email id.
- Caching for results of list of restaurants on home page. So that the API call is not made every time the page is loaded.
- Add a 404 page for UI.
- Show number of results for restaurant search > 20. Maybe have a “load more..” button at the end of the list.
- Make the “Your location” text box as an auto-suggest drop down.
- Allow user to sort the results via criteria like “Distance/Rating/Best Match” etc.
- Ability to delete a review on the UI (Backend API already added)
- Better CSS
Contributions, questions and comments are all welcome and encouraged. For code contributions submit a pull request with unit test.
This project is licensed under the MIT License
Karan Bhomia – [email protected]