glass-isc-dhcp/api/get_subnet_details.js

23 lines
607 B
JavaScript

/**
* Created by cmiles on 8/9/2017.
*/
var express = require('express');
var router = express.Router();
router.get('/', function(req, res, next) {
var json_file = require('jsonfile');
glass_config = json_file.readFileSync('config/glass_config.json');
res.setHeader('Content-Type', 'application/json');
const execSync = require('child_process').execSync;
output = execSync('./bin/dhcpd-pools -c ' + glass_config.config_file + ' -l ' + glass_config.leases_file + ' -f j -A -s e');
// console.log(JSON.parse(output));
res.send(JSON.stringify(JSON.parse(output)));
});
module.exports = router;