diff --git a/lib/httpd.js b/lib/httpd.js index 11a05cb..3ff58cd 100644 --- a/lib/httpd.js +++ b/lib/httpd.js @@ -100,7 +100,8 @@ module.exports.create = function (cli, engine/*, dnsd*/) { })) { next(); } else { - next(new Error("no claim to '" + claim + "' in token")); + res.send({ error: { message: "no claim to '" + claim + "' in token" } }); + return; } }; } @@ -212,8 +213,12 @@ module.exports.create = function (cli, engine/*, dnsd*/) { } app.get('/api/zones/:zone/records', function (req, res) { var zonename = req.params.zone; + // [{ name: zonename }] engine.zones.get({ names: [ zonename ] }, function (err, zones) { + console.log('zone:'); + console.log(zones[0]); var zone = engine.zoneToSoa(zones[0]); + console.log(zone); zone.class = zone.className; zone.type = zone.typeName; engine.records.all(function (err, records) { @@ -251,7 +256,7 @@ module.exports.create = function (cli, engine/*, dnsd*/) { if ('SOA' === record.type) { // TODO be strict about what can be edited - engine.records.save(record, function (err, record) { + engine.zones.save(record, function (err, record) { res.send({ success: true }); }); } else { diff --git a/lib/public/index.html b/lib/public/index.html index 3b635ba..c039c9d 100644 --- a/lib/public/index.html +++ b/lib/public/index.html @@ -117,30 +117,30 @@