npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@limbusfoundation/requesty

v1.2.1

Published

Request Flow Library

Readme

Requesty 1.2.1

Requesty is a lightweight JavaScript library for handling HTTP requests easily.


Installation

NPM :

npm i @limbusfoundation/requesty

Default Configuration

const configTemplate = {
    baseUrl: "https://dummyjson.com",
    appName: "myApp",       // Application name for logs/debugging
    dataConversion: "json", // "json" or "text"
    header: {},            // Global headers
    timeout: 5000,          // Timeout in milliseconds
    retry: 0,               // Number of automatic retry attempts
    debug: false            // Enable debug logging
};

Create a Requesty instance:

import { Requesty } from "requesty";

const api = new Requesty({
    baseUrl: "https://dummyjson.com",
    appName: "myApp",
    dataConversion: "json",
    header: { "Authorization": "Bearer token" },
    timeout: 7000,
    retry: 2,
    debug: true
});

Main Properties

  • baseUrl: Base URL for all requests.
  • appName: Application name used for logging.
  • dataConversion: How the response is parsed (json or text).
  • headers: Global headers for all requests.
  • timeout: Request timeout in milliseconds.
  • query: query params to get on request
  • retry: Number of automatic retry attempts for 5xx errors.
  • debug: Enable detailed logging.
  • interceptRequest: Function to intercept and modify requests before sending.
  • interceptResponse: Function to intercept responses after receiving.
  • cache: Stores successfully fetched data. ...

Structure

All request methods return a Promise that resolves to an object containing { success, status, data, error, controller }.
They also support an optional callback as the last argument.

Request Mode Example - Callback | Promise | Async/Await

// Using callback
api.get("products", {}, (res) => {
    console.log("Callback result:", res);
});

// Using Promise
api.get("products")
   .then(res => console.log("Then result:", res))
   .catch(err => console.error(err));

// Using async/await
const res = await api.get("products");
console.log("Await result:", res);

Methods

get(url, config, callback)

Performs a GET request.

await api.get("products/add",{});

post(url, config, callback)

Performs a POST request.

await api.post("products/add", { body: { name: "New Product" }});

put(url, config, callback)

Performs a PUT request (full update).

await api.put("products/1", { body: { name: "Updated Product" } });

patch(url, config, callback)

Performs a PATCH request (partial update).

await api.patch("/products/1", { body: { price: 19.99 } });

delete(url, config, callback)

Performs a DELETE request.

await api.delete("products/1", {});

cancelRequest(controller)

Cancels an ongoing request using its AbortController.

const { controller } = await api.get("/long-request");
api.cancelRequest(controller);

setBaseUrl(url)

Sets a new base URL for the instance.

api.setBaseUrl("https://newapi.example.com");

data(response)

Filter the data from response

const response = await api.get("products");

const myData = api.data(response);

console.log("My Requesta Data " + myData);

success(response)

Filter if the request is ok ( success )

const response = await api.get("products");

const isOk = api.success(response);

if(isOk) console.log("the request is ok");
if(!isOk) console.log("the request is failed");

status(response)

Filter the status from response

const response = await api.get("products");

const status = api.status(response);

console.log("My Requesta Status " + status);

error(response)

Filter if the response is a error

const response = await api.get("products");

const isError = api.error(response);

if(isError) console.log("the request is Error");
if(!isError) console.log("the request is ok");

Request Options

Query

you can add a list of query params in 'query' option

await api.get("categories", {query: { search: "mycategoryName", myParam : "value" }});

// https.yourdomain/categories?search=mycategoryName?myParam=value

Route

you can add a list of routes in route option

await api.get("posts", { route: ["storys","yourPostId","otherRoute"]});

// https.yourdomain/posts/storys/yourPostId/otherRoute

or your can add directly inside the route :

await api.get("posts/storys/yourPostId/otherRoute");

// https.yourdomain/posts/storys/yourPostId/otherRoute

Body

you can add the body of your request in body option

await api.post("posts", { body: JSON.stringfy(yourJsonBody)});

await api.post("posts", { body: { filmeName : "Iron Man" }});

Header

you can add the Headers of your request in Header option

await api.post("posts", { header: { { "Authorization": "Bearer token" } });

Features

  1. Request Interceptors: Modify requests before sending.
  2. Response Interceptors: Handle or transform responses globally.
  3. Automatic Retries: Retry requests that fail with server errors.
  4. Timeouts: Abort requests that take too long.
  5. Caching: Stores responses to avoid repeated requests.
  6. Debug Mode: Detailed logging for easier debugging.
  7. Callback Support: Optional callback for each request.
  8. Promise-Based: All request methods return a Promise.
  9. Filter the Response: your can filter all data from response
  10. Custom Routes: your can add and control routes with a list of routes

and others...

Full Usage Example

  1. requestyInstanceFile.js
import { Requesty } from '@limbusfoundation/requesty';

// relative path : "yourRelativeFilePath/@limbusfoundation/requesty/src/requesty.js"

const config = {
    baseUrl : "https://dummyjson.com",
    appName : "yourAppName",
    dataConversion : "json",
    headers: {
        'Content-Type': 'application/json', 
        'Authorization': `Bearer token`,
    }
};

export const requesty = new Requesty(config);
  1. yourRequestFile.js

import { requesty } from "./requesty";


async function getProduct(){

    const response = await requesty.get("product");

    if(requesty.error(response)){
        console.warn("Error to get product");
        return;
    }

    const getProduct = requesty.data(response);
    
    console.log("My Product : " + getProduct);
    console.log("My Reponse : " + response)
}

Response Object

All request methods return a Promise resolving to an object:

{
  success: boolean,          // true if HTTP status is 2xx
  status: number,       // HTTP status code
  data: any,            // Parsed response (JSON or text) or null
  error: boolean,       // true if request failed
  controller: AbortController
}
  • Supports JSON and FormData bodies.
  • Timeout and retry logic ensures robust network handling.
  • Debug logs can be enabled for detailed info.

License

© 2025 Limbus Foundation & Community This project is licensed under the MIT License.