Skip to content

Latest commit

 

History

History
82 lines (55 loc) · 1.85 KB

README.md

File metadata and controls

82 lines (55 loc) · 1.85 KB

@nephelaiio/cloudflare-api

An opinionated wrapper for Cloudflare's v4 API.

GitHub license GitHub issues

Description

This package provides an basic interface to interact with Cloudflare's API, with built-in functionality like error handling, retries, and pagination handling.

Installation

To add this package to your project, simply run:

npm install @nephelaiio/cloudflare-api

Usage

import { api } from '@nephelaiio/cloudflare-api';

const options = {
  token: 'YOUR_CLOUDFLARE_TOKEN',
  path: '/zones'
};

async function fetchZones() {
  const data = await api(options);
  console.log(data);
}

fetchZones();

API Options

  • token: Your Cloudflare API token.
  • path: The API endpoint path.
  • method: HTTP method (GET, POST, PUT, PATCH, DELETE, HEAD).
  • body: Request body, if any.
  • ignore_errors: An array of HTTP status codes that should not be treated as errors.

Dependencies

This package has a dependency on @nephelaiio/logger for logging purposes.

Reporting Bugs

For bug reports, please open an issue on GitHub.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you'd like to change.

Ensure your code adheres to our linting and test guidelines:

make lint
make test

TODO

License

This project is licensed under the MIT License - see the LICENSE file for details.