Dyn DNS API connector for node.js.
example 1 :
add A record
var Dynect = require('dynect');
var dynect = new Dynect('customername', 'username', 'password');
dynect.on('connected', function () {
var zone = 'example.com';
dynect.addRecord('A', zone, 'www.example.com', {
address: '123.45.67.89'
}, 300, function (addResponse) {
console.log(addResponse);
dynect.publishZone(zone, function (publishResponse) {
console.log(publishResponse);
dynect.disconnect();
});
});
})
dynect.connect();
example 2 :
add CNAME record
var Dynect = require('dynect');
var dynect = new Dynect('customername', 'username', 'password', 300000);
dynect.on('connected', function () {
var zone = 'example.com';
dynect.addRecord('CNAME', zone, 'www.example.com', {
cname: 'example.mydomain.com'
}, 0, function (addResponse) {
console.log(addResponse);
dynect.publishZone(zone, function (publishResponse) {
console.log(publishResponse);
});
});
})
dynect.connect();
installation
npm install dynect