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.
To install http-suite, run the following command in your project directory:
npm install http-suiteStart by importing the Api class and creating an instance:
import { Api } from 'http-suite/api';
const baseUrl = 'https://your-api-url.com';
const api = new Api(baseUrl);If your API requires authentication, use the bearer method to set the token:
api.bearer('your-auth-token');http-suite supports various HTTP methods like GET, POST, PUT, DELETE, and custom stream methods.
const response = await api.get('/path/url');const postData = { key: 'value' };
const postResponse = await api.post('/path/post-url', postData);const putData = { key: 'updated-value' };
const putResponse = await api.put('/path/put-url', putData);const deleteResponse = await api.delete('/path/delete-url');const streamResponse = await api.stream('/path/stream-url');- 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
ReactiveModelfor state management in API interactions. - Stream processing: Offers a unique way to handle streaming data with custom actions and events.
Contributions are welcome! Please submit a pull request or an issue on the project's GitHub page.
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.