Socket
Socket
Sign inDemoInstall

@bgroup/http-suite

Package Overview
Dependencies
35
Maintainers
5
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @bgroup/http-suite

HTTP-Suite is a comprehensive package designed for modern web development, offering a unified approach to HTTP communications. It elegantly combines reactive models, streamlined API requests, and efficient data streaming, providing a one-stop solution for


Version published
Weekly downloads
76
decreased by-2.56%
Maintainers
5
Created
Weekly downloads
 

Readme

Source

README.md for @bgroup/http-suite

Introduction

@bgroup/http-suite is a comprehensive JavaScript package designed to simplify interactions with APIs. The core of this package is the Api object, which provides an easy-to-use interface for making HTTP requests to an API.

Installation

To install @bgroup/http-suite, run the following command in your project directory:

npm install @bgroup/http-suite

Usage

Creating an Instance of Api

Start by importing the Api class and creating an instance:

import { Api } from '@bgroup/http-suite/api';

const baseUrl = 'https://your-api-url.com';
const api = new Api(baseUrl);

Setting Authentication

If your API requires authentication, use the bearer method to set the token:

api.bearer('your-auth-token');

Making Requests

http-suite supports various HTTP methods like GET, POST, PUT, DELETE, and custom stream methods.

GET Request
const response = await api.get('/path/url');
POST Request
const postData = { key: 'value' };
const postResponse = await api.post('/path/post-url', postData);
PUT Request
const putData = { key: 'updated-value' };
const putResponse = await api.put('/path/put-url', putData);
DELETE Request
const deleteResponse = await api.delete('/path/delete-url');
Stream Request
const streamResponse = await api.stream('/path/stream-url');

Features

  • Easy API interactions: Simplifies the process of making HTTP requests.
  • Bearer token authentication: Easily set authentication tokens for API requests.
  • Supports multiple HTTP methods: GET, POST, PUT, DELETE, and streaming.
  • Reactive model integration: Utilizes ReactiveModel for state management in API interactions.
  • Stream processing: Offers a unique way to handle streaming data with custom actions and events.

Contributing

Contributions are welcome! Please submit a pull request or an issue on the project's GitHub page.

License

http-suite is licensed under MIT License.


Please ensure to modify the example code and descriptions to suit your specific API's needs and structure.

FAQs

Last updated on 08 Feb 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc