Fatsecret.js is an unofficial API wrapper for the FatSecret nutrition database.
- ✔ Full OAuth2 support
- ✔ Fully defined types
- ✔ Classes & helper methods for responses
- ✔ Automatic access token refreshing
# npm
npm install --save-dev fatsecret.js
# yarn
yarn add fatsecret.js
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.