Nexus

A sniperJS HTTP Clients

Nexus HTTP Client

Nexus is a lightweight, fully customizable HTTP client for JavaScript, built-in with SniperJS. It provides an intuitive interface for performing HTTP requests while offering features like caching, request retries, and a flexible configuration system.


Key Features

  • No External Dependencies: Unlike Axios, Nexus is built entirely from scratch using native XMLHttpRequest—keeping it lightweight and reducing dependency bloat.

  • Caching: Built-in caching for GET requests to reduce redundant network calls and improve performance.

  • Retry Mechanism: Automatic retry support for failed requests, configurable with delay and retry counts.

  • Lightweight: Minimal code footprint, ideal for projects prioritizing performance and low overhead.

  • Customizability: Flexible request/response handling, headers management, and error handling.

  • Modern API: Similar to Axios, but simplified with methods like .get, .post, .patch, .put, and .delete.


Why Nexus Over Axios?

  1. Zero Dependencies:

    • Axios relies on external libraries and polyfills, which may increase bundle size. Nexus uses pure native XMLHttpRequest for maximum efficiency.

  2. Built-in Cache:

    • Nexus supports automatic caching for GET requests to optimize repeated requests, a feature missing in Axios by default.

  3. Retry on Failure:

    • Nexus allows you to configure retries for failed requests, making your application more resilient to network issues.

  4. Performance:

    • Lightweight implementation ensures faster load times for small-to-medium applications.

  5. Customizability:

    • Full control over configuration and error handling without Axios’ opinionated behavior.


Since Nexus is lightweight and dependency-free that comes with SniperJS, you can directly use it in your project if you already have SniperJS linked in your HTML document.

<script src="...path/to/sniper.min.js"></script>

Last updated