> For the complete documentation index, see [llms.txt](https://jscula.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jscula.gitbook.io/docs/ajax/nexus-http-client.md).

# Nexus (http client)

A Jscula HTTP Clients

## Nexus HTTP Client

**Nexus** is a lightweight, fully customizable HTTP client for JavaScript, built-in with Jscula. 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 Jscula, you can directly use it in your project if you already have Jscula linked in your HTML document.

```html
<script src="...path/to/jscula.min.js"></script>
```
