Create a recipe search application that finds recipes based on ingredients or cuisine type
Build a recipe finder that allows users to search for recipes by ingredients, cuisine type, or dietary restrictions. Display recipe details including ingredients, instructions, and cooking time.
To get started, you can use the following code snippet to fetch recipes:
async function searchRecipes(query) {
const apiKey = 'YOUR_API_KEY';
const url = `https://api.spoonacular.com/recipes/complexSearch?query=${query}&apiKey=${apiKey}`;
try {
const response = await fetch(url);
const data = await response.json();
displayRecipes(data.results);
} catch (error) {
console.error('Error fetching recipes:', error);
}
}