Add endpoints /api/get_websocket_config and /api/get_glass_config
This commit is contained in:
parent
858806c5b7
commit
29fd1d7591
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* Created by cmiles on 8/13/2018.
|
||||
*/
|
||||
|
||||
var express = require('express');
|
||||
var router = express.Router();
|
||||
var authorize = require('../lib/authorize.js');
|
||||
|
||||
router.get('/', authorize.auth, function (req, res, next) {
|
||||
var json_file = require('jsonfile');
|
||||
var glass_config = json_file.readFileSync('config/glass_config.json');
|
||||
|
||||
/**
|
||||
* Return response
|
||||
*/
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(JSON.stringify(glass_config));
|
||||
});
|
||||
|
||||
module.exports = router;
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* Created by cmiles on 8/13/2018.
|
||||
*/
|
||||
|
||||
var express = require('express');
|
||||
var router = express.Router();
|
||||
|
||||
router.get('/', function (req, res, next) {
|
||||
var json_file = require('jsonfile');
|
||||
var glass_config = json_file.readFileSync('config/glass_config.json');
|
||||
|
||||
/**
|
||||
* Config structure
|
||||
*
|
||||
* @type {{}}
|
||||
*/
|
||||
let websocket_config = {};
|
||||
websocket_config.ws_port = glass_config.ws_port;
|
||||
|
||||
/**
|
||||
* Return response
|
||||
*/
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(JSON.stringify(websocket_config));
|
||||
});
|
||||
|
||||
module.exports = router;
|
2
app.js
2
app.js
|
@ -54,6 +54,8 @@ app.use('/api/get_mac_oui_count_by_vendor/', require('./api/get_mac_oui_count_by
|
|||
app.use('/api/get_dhcp_requests/', require('./api/get_dhcp_requests'));
|
||||
app.use('/api/get_server_info/', require('./api/get_server_info'));
|
||||
app.use('/api/get_mac_oui_list/', require('./api/get_mac_oui_list'));
|
||||
app.use('/api/get_glass_config/', require('./api/get_glass_config'));
|
||||
app.use('/api/get_websocket_config/', require('./api/get_websocket_config'));
|
||||
|
||||
app.set('view engine', 'html');
|
||||
|
||||
|
|
Loading…
Reference in New Issue