npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cloudflare-dns-manager

v1.0.1

Published

Easily automate and manage your CloudFlare DNS records with the Node.js CloudFlare DNS Manager library. This powerful tool allows developers to seamlessly interact with CloudFlare's DNS API, enabling automatic management of DNS records within your Node.js

Downloads

14

Readme

CloudFlare-DNS-Manager

Easily automate and manage your CloudFlare DNS records with the Node.js and Python3 CloudFlare DNS Manager library. This powerful tool allows developers to seamlessly interact with CloudFlare's DNS API, enabling automatic management of DNS records

Installation

NodeJS required version > 10.2.x

npm install cloudflare-dns-manager@latest

Example:

NodeJS:

const CloudflareAPI = require('cloudflare-dns-manager');

// Replace 'your-email' and 'your-api-key' with your actual CloudFlare credentials
// แทน 'your-email' และ 'your-api-key' ด้วยข้อมูลบัญชี CloudFlare ของคุณ
const cfAPI = new CloudflareAPI('[email protected]', 'your-api-key');

// Replace 'your-zone-id' with the actual Zone ID you want to work with
// แทน 'your-zone-id' ด้วย Zone ID ที่คุณต้องการใช้งาน
const zoneId = 'your-zone-id';



(async () => {
	// Example: Add a new DNS record
	// ตัวอย่าง: เพิ่ม record DNS ใหม่
	const targetIp = '192.168.1.1';
	const recordName = 'example.com';
	const recordType = 'A';
	try {
	    const result = await cfAPI.addDnsRecord(targetIp, recordName, recordType, zoneId);
	    console.log(result);
	} catch (error) {
	    console.error(error);
	}
	
	// Example: Get the list of DNS records
	// ตัวอย่าง: ดึงรายการระเบียน DNS
	try {
	    const result = await cfAPI.dnsScan(zoneId);
	    console.log(result);
	} catch (error) {
	    console.error(error);
	}
	
	// Example: Update a DNS record
	// ตัวอย่าง: อัปเดท record DNS
	const updatedIp = '192.168.1.2';
	const recordIdToUpdate = 'record-id-to-update'; // Replace with the actual record ID
	try {
	    const result = await cfAPI.updateDnsRecord(updatedIp, recordName, recordType, zoneId, recordIdToUpdate);
	    console.log(result);
	    // If you want Data only. หากต้องการสำหรับข้อมูลเท่านั้น.
	    console.log(result.data);
	} catch (error) {
	    console.error(error);
	}
	
	// Example: Delete a DNS record
	// ตัวอย่าง: ลบ record DNS
	const recordIdToDelete = 'record-id-to-delete'; // Replace with the actual record ID
	try {
	    const result = await cfAPI.deleteDnsRecord(zoneId, recordIdToDelete);
	    console.log(result);
	} catch (error) {
	    console.error(error);
	}
})();

FAQ

  • How to get cloudflare API ? -> Read here <-
  • Where do i get zoneId ?
    1. Visit https://dash.cloudflare.com
    2. Select your domain .
    3. Then click copy here.

Class function infromation

Usage for each function in the class.

| Class Function | Args| Response json key | |----------------|-------------------------------|-----------------------------| |dnsScan|zoneId |success, exception, message, data | |addDnsRecord |targetIp, name, recordType, zoneId, comment, ttl |success, exception, message, data | |updateDnsRecord |targetIp, name, recordType, zoneId, comment, ttl |success, exception, message, data | |deleteDnsRecord |zoneId, recordId|success, exception, message, data |

Inside

graph LR
A[Library] -- Axios --> B(Cloudflare API)
D --Response--> A(Library)
B -- Communication --> D((Cloudfalre DNS))

Update

Python3 library is coming soon