1.0.5 • Published 5 months ago

fmana v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

Mana

Mana Mana is a lightweight and flexible HTTP request library for JavaScript/TypeScript applications. Easily configurable, 100% typed, and supports interceptors for requests and responses. All built by extending the Request interface for greater security and predictability.

Features

  • Customizable HTTP request methods (GET, POST, PUT, PATCH, DELETE).
  • Request and response interceptors.
  • Supports both client-side (browser) and server-side (Node.js) usage.

Installation

To install the library, run:

npm install @okubo/mana

or

pnpm install @okubo/mana

API Methods

GET

const getResource = async () => {
  try {
    const res = await get<YourType>("your-request-url");
  } catch (error) {
    console.error(error);
  }
};

POST

const getResource = async () => {
  try {
    const res = await post<YourType>("your-request-url", {
        body: {
            for: 'bar'
        }
    });
  } catch (error) {
    console.error(error);
  }
};

PATCH

const getResource = async () => {
  try {
    const res = await patch<YourType>("your-request-url/id", {
        body: {
            for: 'bar'
        }
    });
  } catch (error) {
    console.error(error);
  }
};

PUT

const getResource = async () => {
  try {
    const res = await put<YourType>("your-request-url/id", {
        body: {
            for: 'bar'
        }
    });
  } catch (error) {
    console.error(error);
  }
};

DELETE

const getResource = async () => {
  try {
    const res = await _delete<YourType>("your-request-url/id");
  } catch (error) {
    console.error(error);
  }
};
1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.0

6 months ago