CommonJS (Older Node.js)
For older Node.js versions or projects using CommonJS modules, install via your preferred package manager:
Using npm
npm install lunex-http
Using Yarn
yarn add lunex-http
Using pnpm
pnpm add lunex-http
Once installed, import and use the client using require:
const { LunexClient, LunexClientOptions } = require('lunex-http');
const client = new LunexClient('https://api.example.com', {
Authorization: 'Bearer YOUR_TOKEN'
}, new LunexClientOptions({
timeout: 5000,
maxRetries: 3
}));
This method is ideal for legacy Node.js projects without ES module support. Full TypeScript typings remain available for compatible TypeScript projects.