4 points · by brunooliv · 2y ago · 8 comments
I started with a list of ingredients and my prompts were along the lines of: give me a list of healthy vegan or vegetarian recipes with these ingredients. From there I decided to be very efficient and said that I needed to turn that concept into a simple search engine and host it in the simplest possible way and I actually learned about Glitch thanks to it!! Just type an ingredient and get back a list of healthy recipes containing said ingredient!
Incredibly simple and fun and it truly puts the simplicity and joy right back into building things!!
Besides that I was also wondering what kind of tech stack did you use to create the search?
I'm still looking for a similar solution to query data on my Wordpress website (it's currently inside an app but I want to transition to an all-in-one solution eventually).
function searchRecipes() {
const input = document.getElementById('searchInput').value.toLowerCase();
const filteredRecipes = recipes.filter(recipe =>
recipe.ingredients.some(ingredient =>
ingredient.toLowerCase().includes(input)
)
);
displayResults(filteredRecipes);
}
recipes is an array of objects like this: {
name: "Ginger Tofu Stir-Fry",
ingredients: ["Tofu", "Broccoli", "Bell peppers", "Ginger", "Garlic", "Soy sauce", "Scallions", "Sesame oil", "Rice vinegar"],
instructions: "Stir-fry tofu with broccoli, bell peppers, ginger, and garlic. Add soy sauce, sesame oil, and rice vinegar. Garnish with scallions."
}Now responsive!