Nuclear Powered Mushroom

    fooddata-central
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.0 • Public • Published

    fooddata-central

    NPM Build

    Node.js client and API types for USDA FoodData Central.

    FoodData Central is an API provided by the U.S. Department of Agriculture that provides expanded nutrient profile data for foods.

    Getting Started

    yarn add fooddata-central

    Prerequisites

    An API key is required to interact with the FoodData Central API. Sign-up for an API key.

    Usage

    import Client from "fooddata-central";
     
    (async () => {
      // initialize a new client
      const client = new Client({ api_key: "API_KEY" });
     
      // search foods based on an input
      const results = await client.search({ generalSearchInput: "raw broccoli" });
     
      if (results.success) {
        // get details for food item
        const details = await client.details(results.data.foods[0].fdcId);
     
        if (details.success) {
          console.log(details.data);
        }
      }
    })();

    License

    MIT

    Install

    npm i fooddata-central

    DownloadsWeekly Downloads

    0

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    8.99 kB

    Total Files

    9

    Last publish

    Collaborators

    • metonym