godaddy-dns-api
v1.0.0
Published
Godaddy client library.
Downloads
3
Readme
godaddy-dns-api
A Node.js client library for interacting with GoDaddy DNS API.
Install
npm i --save godaddy-dns-api
Example
const { DNS, RecordTypes } = require('godaddy-dns-api')
// create dns api object with specified options
const options = {
environment: 'OTE or Production',
key: 'api key',
secret: 'api secret',
domain: 'your domain on Godaddy',
}
const dns = new DNS(options)
const start = async () => {
// list
const [err, result] = await dns.getList({
type: 'A',
// name: 'optional record name',
})
console.log(err ? err.message : result)
// create
const data2 = Object.assign({}, RecordTypes.A) // clone a record type A template object
data2.name = 'olala' // sub domain
data2.data = '127.0.0.4' // point to an IP
const [err3, result3] = await dns.create(data2) // call API
console.log(err3 ? err3 : result3)
// update a specific record
const [err2, result2] = await dns.update({
type: 'A',
name: 'foo',
}, {
data: '127.0.0.1' // new IP
})
console.log(err2 ? err2 : result2) // call API
}
start()