@bundly/ares
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

Ares

HTTP client for calling REST APIs and seamlessly integrating Internet Identity with them.

NOTE: This is a Beta version

How to use

Basic usage

const response = await ares<TestResponse>({
  url: `${process.env.NEXT_PUBLIC_API_REST_URL}/test`,
  method: "POST",
  data: {
    message: "Hello, World!",
  },
  headers: {
    "Content-Type": "application/json",
  },
});

Direct access to a method

const response = await ares.post<TestResponse>(
  `${process.env.NEXT_PUBLIC_API_REST_URL}/test`,
  {
    message: "Hello, World!",
  },
  {
    headers: {
      "Content-Type": "application/json",
    },
  }
);

Create an instance

const instance = ares.create({
  baseURL: `${process.env.NEXT_PUBLIC_API_REST_URL}`,
});

const response = await instance.post<TestResponse>(
  "/test",
  {
    message: "Hello, World!",
  },
  {
    headers: {
      "Content-Type": "application/json",
    },
  }
);

Package Sidebar

Install

npm i @bundly/ares

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

81.8 kB

Total Files

9

Last publish

Collaborators

  • adrian.hidalgo
  • alannnc