Creating an Instance

Create a Nexus Instance

Start by creating an HTTP client instance using the nexus.create method:

const client = nexus.create({
  baseURL: 'https://api.example.com',
  headers: {
    'Authorization': 'Bearer <YOUR_TOKEN>',
    'Content-Type': 'application/json',
  },
  cacheEnabled: true, // Enables response caching for GET requests
  retryConfig: { retries: 3, delay: 1000 }, // Retry failed requests
});

Last updated