Edamam-api is a helper library for the Edamam nutritional API.
Full documentation for Edamam's services can be found here under the Documentation tab.
npm install --save edamam-api
Example
const { RecipeSearchClient } = require('edamam-api');
const client = new RecipeSearchClient({
appId: '<Your Edamam Recipe Search App Id>',
appKey: '<Your Edamam Recipe Search App Key>'
});
const results = await client.search({ query: 'Bread' });
Methods
- Search:
client.search({ query })
Example
const { FoodDatabaseClient } = require('edamam-api');
const client = new FoodDatabaseClient({
appId: '<Your Edamam Food Database App Id>',
appKey: '<Your Edamam Food Database App Key>'
});
const foods = client.search({ query: 'Flour' });
Methods
- Search:
client.search({ query })
- Get Nutrients:
client.getNutrients({ ingredients: [{ quantity, measureURI, foodId }]})
- Autocomplete:
client.autocomplete({ query, limit })
Example
const { NutritionAnalysisClient } = require('edamam-api');
(async () => {
const client = new NutritionAnalysisClient({
appId: '<Your Edamam Nutrition Analysis App Id>',
appKey: '<Your Edamam Nutrition Analysis App Key>'
});
const results = await client.search({ query: 'Chicken' });
})();
Methods
- Analyze Recipe:
client.analyzeRecipe({ recipe })
- Get Nutrition Data:
client.getNutritionData({ ingredient })
Example
const { FoodDatabaseClient, Measures } = require('edamam-api');
const client = new FoodDatabaseClient({
appId: '<Your Edamam Food Database App Id>',
appKey: '<Your Edamam Food Database App Key>'
});
const nutrients = await client.getNutrients({
ingredients: [{
quantity: 1,
measureURI: Measures['kilogram'],
foodId: 'food_ashlcg6b4ansska87l39xb0dnupz' // edamam id for an apple
}]
});