- Docker
- Npm
- .env(not included here)
- Clone Repo
git clone https://github.com/olsenme/Yelp.git
- Install dependencies
npm install
- Start up mySql and Mongo DB
docker-compose up mongo mysql
- Start up the API
docker-compose up api
- Send appropriate queries (using cURL, Postman, etc.) to
http://localhost:8003/
I used NodeJS,mySql,mongoDB,Docker,and JWT to build this API.
Design and build a RESTFUL API for a Yelp-like application.
- The application will be centered around businesses and user reviews of businesses in US cities.
- Users may add their business to the application.
- Business information shall include:
- Business name
- Business street name
- Business city
- Business state
- Business ZIP code
- Business phone number
- Business categories and subcategories
- Business website(optional)
- Business email(optional)
- Users may register with a username and password.
- Users may modify any of the information listed above for an already-existing business they own.
- Users may remove a business from the application.
- Users may get a list of businesses.
- Users may fetch detailed information about a business.
- Detailed business information will include all of the information described above as well as reviews of the business and photos of the business.
- Users may write a review of an existing business.
- Business information shall include:
- A "star" rating between 0 and 5 (e.g. 4 stars)
- A "dollar sign" rating between 1 and 4, indicating how expensive the business is (e.g. 2 dollar signs)
- A written review(optional)
- A user may write at most one review of any business.
- Users may modify or delete any review they've written.
- Users may upload image files containing photos of an existing business.
- Each photo may have an associated caption(optional).
- Users may remove any photo they've uploaded, and they may modify the caption of any photo they've uploaded.
- Users may list all of the businesses they own.
- Users may list all of the reviews they've written.
- Users may list all of the photos they've uploaded.
- Users may create categories and subcategories that will be used when creating businesses.
- Categories and subcategories are the following:
- Restaurant
- Pizza
- Mexican
- Chinese
- Brewpub
- Shopping
- Grocery store
- Flowers
- Clothing
- Hardware
- Arts and Entertainment
- Museum
- Art gallery
- Movie theater
- Users may delete or modify categories and subcategories.
- Users may list all categories.
- Users may list all subcategories associated with a given category.
- Registered users may log in with their username and password.
- Port will be 8003.
- Endpoints will have paginated responses where appropriate.
- Each API endpoint will respond with an appropriate HTTP status code and, when needed, a response body.
- Any API endpoint that takes a request body will perform basic verification of the data provided in the request body.
- Any API endpoint with a parameterized route will perform basic verification of the specified route parameters.
- A route will be included to implement each of the API endpoints in design.
- Server will be containerized into a Docker image with runtime dependencies.
- A MySQL database will be used to store:
- Businesses
- Reviews
- Photos
- Official MYSQL Docker Image will be used to power MySQL database.
- Database script will be used to initialize MySQL database upond first launch of container.
- Database will be persisted in Docker voume.
- API server will read the location(hostname,database Name) and credentials(username and password) from environment variables.
- Username
- Email Address
- Hashed/salted password
- Official Mongo Docker Image will be used to power MongoDb database.
- Script will be written to create a low-privileged user to use to connect to MongoDB server from Node.js.
- Three container application will be created and run via Docker Compose.
Implement endpoints
Containers launched from this image will automatically start the server listening on a specified port, and one should be able to successfully make requests to the containerized server from the outside world (e.g. from your host machine).
A MongoDB will be used to store: