edamam-api
v1.1.3
Published
Node.js helper library https://edamam.com
Downloads
9
Maintainers
Readme
edamam-api
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.
Installation
npm install --save edamam-api
Usage
Recipe Search
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 })
Food Database
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 })
Nutrition Analysis
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 })
Measures
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
}]
});