1.0.5 • Published 12 months ago

api-reader-package v1.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

API Reader Package

Overview: The api-reader-package is a lightweight Node.js package designed to help developers easily fetch data from APIs. It uses axios for making HTTP requests and dotenv for managing environment variables, allowing for secure handling of API keys and URLs.

Features:

  • Simple API Requests: Easily fetch data from APIs with minimal setup.
  • Environment Variable Management: Securely manage API keys and URLs using .env files.
  • Lightweight: Minimal dependencies ensure fast installation and performance.

Installation: To install the package, use NPM:

npm install api-reader-package

Usage:

  1. Install the package (if you haven't already) using:

npm install api-reader-package
  1. Create a .env file in the root of your project to store your API URL and API key. Example content for .env:
API_URL=https://newsapi.org/v2/top-headlines
API_KEY=your_api_key_here
  1. Import and use the package in your project with the following code:
import aniData from 'api-reader-package';

(async () => {
    const apiUrl = process.env.API_URL;
    const apiKey = process.env.API_KEY;

    try {
        const data = await aniData(apiUrl, apiKey);
        console.log(JSON.stringify(data, null, 2));
    } catch (error) {
        console.error('Error fetching data:', error.message);
    }
})();

Example: This package allows you to quickly set up and fetch data from an API by simply providing the API URL and an API key in a .env file. The data is returned in JSON format and can be easily manipulated or displayed as needed.

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago