FatSecret API Wrapper
This package is an unofficial fatsecret.com API wrapper for Node.js. The FatSecret API, in addition to many other features, allows you to gather nutritional information about foods.
Install
# install locally
npm install fatsecret-api --save
Highlights
- ✔ Full type-definitions
- ✔ Automatic access token refreshing
- ✔ Uses OAUTH2
Usage
Initialize a new FatSecretClient
instance with your credentials.
import { FatSecretClient } from "fatsecret-api";
const fatSecretClient = new FatSecretClient({
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
scope: "SEE_FATSECRET_DOCS",
});
Methods
Examples of basic methods on the FatSecretClient
instance. To see documentation on parameters and responses please visit the official docs here.
await fatSecretClient.getFood({ food_id: "4278773" });
await fatSecretClient.getFoodSearch({ search_expression: "Cereal" });
await fatSecretClient.getRecipe({ recipe_id: "31341" });
await fatSecretClient.getRecipeSearch({ search_expression: "Brownies" });
📌 OAUTH1 is currently not supported.