Getting Started
Introduction
Modern HTTP client based on Fetch API with built-in support for retries, timeouts, and JSON handling.
Reqo is a powerful, type-safe HTTP client built on top of the modern Fetch API. It provides a clean and intuitive interface for making HTTP requests with advanced features like automatic retries, configurable timeouts, hooks system, and seamless JSON handling.
Features
- Type-Safe - Full TypeScript support with comprehensive type inference
- Fetch-Based - Built on the modern Fetch API standard
- Automatic Retries - Configurable retry logic with exponential backoff
- Timeout Support - Request timeouts with automatic cancellation
- Hooks System - Extensible lifecycle hooks for request/response interception
- JSON Handling - Automatic JSON serialization and deserialization
- Error Handling - Rich error types with detailed request context
- Promise-Based - Returns Futures (cancelable promises) for all requests
- Multiple Response Types - Support for JSON, text, blob, and arrayBuffer
- URL Building - Automatic URL construction with query parameters
- Headers Management - Type-safe header handling
Use Cases
- Frontend applications making API calls
- Backend services communicating with external APIs
- Microservices inter-service communication
- CLI tools interacting with web services
- Any TypeScript/JavaScript project needing a robust HTTP client
Quick Example
import { reqo } from '@outloud/reqo'
// Simple GET request
const data = await reqo.$get('https://api.example.com/users')
// POST with data and error handling
try {
const user = await reqo.$post('https://api.example.com/users', {
name: 'John Doe',
email: 'john@example.com'
}, {
timeout: 5000,
retry: { limit: 3 }
})
console.log('User created:', user)
} catch (error) {
if (reqo.isError(error)) {
console.error('Request failed:', error.status, error.data)
}
}