Nutritionix API v2.0 Beta NodeJS Client Library
NOTE This library is still in beta and subject to change.
Installation
npm install nutritionix --save
// Require inside your projectvar NutritionixClient = ;var nutritionix = appId: 'YOUR_APP_ID' appKey: 'YOUR_APP_KEY' // debug: true, // defaults to false;
Execute an autocomplete query
// This will perform a fuzzy autocomplete query and return suggestionsnutritionix ;
Execute a natural search
var ingredients = '1 tbsp sugar' '1 red pepper'; // ensure you are passing a string with queries delimited by new lines.nutritionix ;
id
or search resource_id
Get Item By // this will locate an item by its (id, resource_id, or upc)nutritionix ;;
id
Get Brand By // this will locate a brand by its idnutritionix ;
Standard Search
// This will perform a search. The object passed into this function// can contain all the perameters the API accepts in the `POST /v2/search` endpointnutritionixsearch ;
Brand Search
// This will perform a search. The object passed into this function// can contain all the perameters the API accepts in the `GET /v2/search/brands` endpointnutritionix ;
Take a look tests/index.js
for an end to end usecase for these libraries.