32 lines
765 B
JavaScript
32 lines
765 B
JavaScript
|
'use strict';
|
||
|
|
||
|
module.exports.create = function (cli, engine, dnsd) {
|
||
|
|
||
|
function runHttp() {
|
||
|
var path = require('path');
|
||
|
var express = require('express');
|
||
|
var app = express();
|
||
|
var httpServer = require('http').createServer(app);
|
||
|
|
||
|
app.use('/', express.static(path.join(__dirname, 'public')));
|
||
|
app.get('/api/peers', function (req, res) {
|
||
|
res.send({ nameservers: [] });
|
||
|
});
|
||
|
app.get('/api/zones', function (req, res) {
|
||
|
engine.zones.all(function (zones) {
|
||
|
res.send({ zones: zones });
|
||
|
});
|
||
|
});
|
||
|
app.get('/api/records/:zone', function (req, res) {
|
||
|
engine.records.all(function (records) {
|
||
|
res.send({ records: records });
|
||
|
});
|
||
|
});
|
||
|
|
||
|
httpServer.listen(cli.http);
|
||
|
}
|
||
|
|
||
|
runHttp();
|
||
|
|
||
|
};
|