@sryden/matrix

1.0.0 • Public • Published

SRYDEN Matrix

Matrix is a Node.js module for HTTP GET and POST requests within SRYDEN products.

Installation

Install Matrix using npm:

npm install @sryden/matrix

Usage

const Matrix = require('@sryden/matrix');
const request = Matrix();

// Example GET request
request.get({
  url: 'https://example.com',
})
  .then((response) => {
    console.log('GET response:', response);
  })
  .catch((error) => {
    console.error('GET error:', error.message);
  });

// Example POST request
request.post({
  url: 'https://example.com',
  data: { title: '1', body: '2', userId: 1 },
})
  .then((response) => {
    console.log('POST response:', response);
  })
  .catch((error) => {
    console.error('POST error:', error.message);
  });

Request

matrix(config)

Creates a new instance of the SRYDEN Matrix module.

  • config (optional): Configuration object for the Matrix instance.

get(options)

Performs an HTTP GET request.

  • options: Object with the following properties:
    • url (required): The URL for the GET request.
    • params (optional): Query parameters for the request.

post(options)

Performs an HTTP POST request.

  • options: Object with the following properties:
    • url (required): The URL for the POST request.
    • data (optional): Data to be sent in the request body.
    • config (optional): Additional configuration for the request.

Readme

Keywords

none

Package Sidebar

Install

npm i @sryden/matrix

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

3.09 kB

Total Files

3

Last publish

Collaborators

  • halex