Skip to content
/ grab-js Public

Lightweight HTTP client for constrained environments. Grab.js offers smart retries, caching, and circuit breakers. Perfect for efficient API interactions. πŸš€πŸŒ

License

Notifications You must be signed in to change notification settings

wasqwf/grab-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Grab.js: A Lightweight HTTP Client with Advanced Features πŸš€

Grab.js Version License

Download Latest Release

Table of Contents

Overview

Grab.js is a compact HTTP client that packs powerful features into just 5KB. Designed for developers who need speed and efficiency, Grab.js offers capabilities like circuit breakers, ETags, and request deduplication. Whether you're building a small application or a large system, Grab.js simplifies your HTTP requests.

Features

  • Lightweight: At only 5KB, Grab.js is perfect for performance-focused applications.
  • Circuit Breakers: Prevents system overload by managing failed requests intelligently.
  • ETags Support: Efficiently handles caching to reduce server load and speed up responses.
  • Request Deduplication: Avoids duplicate requests, ensuring that your application runs smoothly.
  • Promise-based API: Simplifies asynchronous programming with a clean, easy-to-use interface.

Installation

To get started with Grab.js, you can install it via npm:

npm install grab-js

Alternatively, you can download the latest release from the Releases section. Make sure to download and execute the file to set it up correctly.

Usage

Using Grab.js is straightforward. Here’s a quick example to demonstrate how to make a simple GET request:

import Grab from 'grab-js';

const client = new Grab();

client.get('https://api.example.com/data')
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error fetching data:', error);
  });

Advanced Usage

You can also take advantage of the advanced features. Here’s how to use circuit breakers:

const client = new Grab({
  circuitBreaker: {
    failureThreshold: 5,
    timeout: 3000,
  }
});

client.get('https://api.example.com/data')
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error fetching data:', error);
  });

API Reference

Grab(options)

Creates a new Grab instance.

  • options: An object to configure the client.

client.get(url, options)

Makes a GET request to the specified URL.

  • url: The URL to fetch.
  • options: Additional options for the request.

client.post(url, data, options)

Makes a POST request to the specified URL.

  • url: The URL to send data to.
  • data: The data to send.
  • options: Additional options for the request.

Contributing

We welcome contributions to Grab.js! If you'd like to help out, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and commit them.
  4. Push your branch and submit a pull request.

Please ensure your code follows the project's style guidelines and includes appropriate tests.

License

Grab.js is licensed under the MIT License. See the LICENSE file for more details.

Support

For support, please check the Releases section for the latest updates and fixes. You can also open an issue in the repository if you encounter any problems.

Grab.js Logo

Feel free to explore the features of Grab.js and see how it can enhance your HTTP requests. For further information, visit the Releases section to stay updated on the latest changes and improvements.

About

Lightweight HTTP client for constrained environments. Grab.js offers smart retries, caching, and circuit breakers. Perfect for efficient API interactions. πŸš€πŸŒ

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •