Lunch and Learn Table of Contents
The overarching goal of the project is to allow users to explore cuisines through a simple country search, save their favorite recipes for later, and provide educational material related to the cuisine's country.
The project is designed using Service Oriented Architecture, with this app serving as the backend service.
- Expose an API that aggregates data from multiple external APIs
- Expose an API that requires an authentication token
- Expose an API for CRUD functionality
- Test, both, API consumption and exposure using a mocking tool (Webmock)
- country input is varified by using Restcountries
- recipes from Edamam
- videos providing a brief history of the country from Youtube
- popular photo images of the country from Unsplash
Users: A users must have a unique email address. We create an API key for each user. Users can have many favorite recipes.
Favorites: we store the title, url, and the country that relates to the recipes.
Ruby & Rails version:
Ruby '2.7.4'
Rails 5.2.8.1
To run the app locally run the following 4 commands in your termianl :
- Clone the app to your local pc: $
git clone git@github.com:Sergio-Azcona/lunch_and_learn_BE.git
- Set up the Gems & dependencies: $
bundle install
- Database creation: $
rails db:{drop,create,migrage,seed}
- Run the server on localhost:3000: $
rails s
Additionally, you can now run the test suite: $ bundle exec rspec spec
Creating Users and Favorites
Users
Creating a user:- Users require a name and unique email address
- API Endpoint: http://localhost:3000/api/v1/users
Recipes, Learning Resources, and User's Favorites
Recipes
Happy Paths Recipes can be search by country or by letting the app select a country for them.- Searching by country: pass a country name as a query param to the endpoint
http://localhost:3000/api/v1/recipes?country=country_name - example: search results for thailand:
http://localhost:3000/api/v1/recipes?country=thailand - Random Searching: no country is passed in the query parms; endpoint
http://localhost:3000/api/v1/recipes - Random Searching: no country is passed in the query parms; endpoint
Learning Resources
-
Happy Paths:
- Searching by country: pass a country name as a query param to the endpoint (name can partial or full)
http://localhost:3000/api/v1/learning_resources?country=country_name - example: search results for marsh, which returns responses for Marshall Islands:
http://localhost:3000/api/v1/learning_resources?country=marsh - Response when a country name is invalid:
Sad Paths: