Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

fexjs

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fexjs

A lightweight and powerful Fetch API wrapper with interceptors, cancel tokens, and timeout support.

latest
Source
npmnpm
Version
1.0.15
Version published
Weekly downloads
18
-45.45%
Maintainers
1
Weekly downloads
 
Created
Source

fexjs 🚀

A lightweight and powerful Fetch API wrapper with interceptors, cancel tokens, and timeout support.

npm license issues

✨ Features

  • Interceptors: Request & Response hooks like Axios.
  • Timeout Support: Automatically aborts slow requests.
  • Cancel Tokens: Similar to Axios' CancelToken.
  • Base URL Support: Define base URLs for API calls.
  • Lightweight & No Dependencies: Uses only native fetch.

Funding!

https://github.com/sponsors/gloomystore

📦 Installation

npm install fexjs

🚀 Usage

🔹 Basic GET Request

import fex from "fexjs";

fex.get("https://jsonplaceholder.typicode.com/posts/1")
  .then((res) => console.log(res.data))
  .catch((err) => console.error(err));

🔹 POST Request with JSON Body

fex.post("https://jsonplaceholder.typicode.com/posts", {
  title: "New Post",
  body: "This is the content.",
  userId: 1
}).then((res) => console.log(res.data));

🔹 Using Interceptors

const fexInstance = fex.create({
  baseURL: "https://api.example.com",
  timeout: 5000
});

fexInstance.interceptors.request.use((config) => {
  config.headers["Authorization"] = "Bearer mytoken";
  return config;
});

📜 API Reference

fex.create(config)

Creates a new instance of fex with custom defaults.

fex.get(url, config)

Sends a GET request.

fex.post(url, data, config)

Sends a POST request with a JSON body.

fex.options(url, config)

Sends an OPTIONS request.

🛠 Development

git clone https://github.com/gloomystore/fexjs.git
cd fexjs
npm install
npm run build

📜 License

MIT © gloomystore

Keywords

fetch

FAQs

Package last updated on 21 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts