JSFiddle - React, Tailwind, and code Playground

by Fareez Ahmed

HTML

<!-- Response url from "allowedAllergy[]": ["Seafood-Free"]
includes items with shrimp!
-->
http://api.yummly.com/v1/api/recipes?callback=angular.callbacks._2&_app_id=getone&_app_key=getone&allowedAllergy%5B%5D=Seafood-Free&maxResult=6&q=Comfort+Food&requirePictures=true

<!-- Response url from "excludedIngredient[]": ["shrimp"] 
includes items with shrimp!
-->
http://api.yummly.com/v1/api/recipes?callback=angular.callbacks._1&_app_id=getone&_app_key=getone&excludedIngredient%5B%5D=Shrimp&maxResult=6&q=Pan-Asian&requirePictures=true

JavaScript

<!-- call with "allowedAllergy" --> 
getRecipesByRestrictions: function (randomGenre, allergy) {
        console.log(allergy);
        console.log(randomGenre);
        return $http.jsonp("http://api.yummly.com/v1/api/recipes?callback=JSON_CALLBACK" , {
          params: {
            "_app_id": id,
            "_app_key": key,
            "q": randomGenre,
            "maxResult": 6,
            "allowedAllergy[]": ["Seafood-Free"],
            "requirePictures": true
          }
        }).then(function (response) {
          console.log(response.data);
          return response.data.matches;
        });
      },
          
<!-- call with "excludedIngredient -->
    
      getRecipesByRestrictions: function (randomGenre, allergy) {
        console.log(allergy);
        console.log(randomGenre);
        return $http.jsonp("http://api.yummly.com/v1/api/recipes?callback=JSON_CALLBACK" , {
          params: {
            "_app_id": id,
            "_app_key": key,
            "q": randomGenre,
            "maxResult": 6,
            // "allowedAllergy[]": ["Seafood-Free"],
             "excludedIngredient[]": ["Shrimp"],
            "requirePictures": true
          }
        }).then(function (response) {
          console.log(response.data);
          return response.data.matches;
        });
      },