Skip to content

Latest commit

 

History

History
56 lines (42 loc) · 1.52 KB

README.md

File metadata and controls

56 lines (42 loc) · 1.52 KB

fatsecret.js Logo

Github       Docs


Fatsecret.js is an unofficial API wrapper for the FatSecret nutrition database.

Highlights

  • ✔ Full OAuth2 support
  • ✔ Fully defined types
  • ✔ Classes & helper methods for responses
  • ✔ Automatic access token refreshing

Installation

# npm
npm install --save-dev fatsecret.js

# yarn
yarn add fatsecret.js

Basic Usage

Simple example of getting a food with id 1234 and logging it to the console.

// initialize new client
const client = new FatSecret.Client({
  credentials: {
    clientId: 'fatsecret client id',
    clientSecret: 'fatsecret client secret',
    scope: ['premier', 'barcode'], // your scopes
  },
});

// get food with id
const foundFood = await client.getFood({ foodId: '1234' });

console.log(foundFood); // Food {id: '1234'...}

📌 Only 4 food related methods currently supported.