Features Breakdown

1. Caching for GET Requests

Enable caching to avoid redundant network requests. Cached responses are served instantly.

const client = nexus.create({
  baseURL: 'https://api.example.com',
  cacheEnabled: true,
});

client.get('/posts'); // Network call
client.get('/posts'); // Served from cache

2. Retry Mechanism

Configure automatic retries for transient failures:

const client = nexus.create({
  baseURL: 'https://api.example.com',
  retryConfig: { retries: 3, delay: 1000 }, // 3 retries with 1-second delay
});

Comparison: Nexus vs Axios

Feature

Nexus

Axios

Dependencies

None

Yes

Caching

Built-in for GET

No (requires custom code)

Retry Mechanism

Built-in

No (requires plugins)

File Size

Lightweight

Larger (external deps)

Customizability

High

Moderate

Ease of Use

Simple, intuitive

Simple

Error Handling

Structured with response

Basic

Last updated