Skip to content

Repository files navigation

Cloudflare Node.js bindings

Stability StableNPM versionTravis CICoverallsNPM downloadsLibraries.io Dependencies

Cloudflare v4 API bindings for Node.js, providing a sourdough "BREAD" (Browse, Read, Edit, Add, and Delete) interface.

With these bindings, you'll get the following features:

  • A Promise-based API. With modern versions of Node.js, this can be leveraged for async/await and generator support.
  • Automatic handling of Gzip/Deflate compression.

Node.js v4 and greater are supported.

Configuration

API Keys

Set your account email address and API key. The API key can be found on the My Profile -> API Tokens page in the Cloudflare dashboard.

varcf=require('cloudflare')({email: 'you@example.com',key: 'your Cloudflare API key'});

API Tokens (BETA)

Create your token on the My Profile -> API Tokens page in the Cloudflare dashboard.

varcf=require('cloudflare')({token: 'your Cloudflare API token'});

API Overview

Every resource is accessed via your cf instance:

// cf.{ RESOURCE_NAME }.{ METHOD_NAME }

Every resource method returns a promise, which can be chained or used with async/await.

cf.zones.read('023e105f4ecef8ad9ca31a8372d0c353').then(function(resp){returnresp.result.status;});// where supportedasyncfunctiongetZoneStatus(id){varresp=awaitcf.zones.read('023e105f4ecef8ad9ca31a8372d0c353');returnresp.result.status;}

Documentation

About

Node.js API for Client API

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages