Connect to any API with confidence

JS  api-client.js
// REST API client with authentication
class ApiClient {
  constructor(baseURL, apiKey) {
    this.baseURL = baseURL;
    this.apiKey = apiKey;
  }

  async request(endpoint, options = {}) {
    const url = this.baseURL + endpoint;
    const response = await fetch(url, {
      ...options,
      headers: {
        'Authorization': 'Bearer ' + this.apiKey,
        'Content-Type': 'application/json'
      }
    });
    return response.json();
  }
}