config endpoint to get device and universe configuration
This commit is contained in:
parent
4f188f06b3
commit
b6a2ff7454
1 changed files with 9 additions and 0 deletions
|
@ -56,6 +56,15 @@ function DMXWeb() {
|
||||||
res.sendfile(__dirname + '/index.html')
|
res.sendfile(__dirname + '/index.html')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
app.get('/config', function(req, res) {
|
||||||
|
var response = {"devices": DMX.devices, "universes": {}}
|
||||||
|
Object.keys(config.universes).forEach(function(key) {
|
||||||
|
response.universes[key] = config.universes[key].devices
|
||||||
|
})
|
||||||
|
|
||||||
|
res.json(response)
|
||||||
|
})
|
||||||
|
|
||||||
app.get('/state/:universe', function(req, res) {
|
app.get('/state/:universe', function(req, res) {
|
||||||
if(!(req.params.universe in dmx.universes)) {
|
if(!(req.params.universe in dmx.universes)) {
|
||||||
res.status(404).json({"error": "universe not found"})
|
res.status(404).json({"error": "universe not found"})
|
||||||
|
|
Loading…
Reference in a new issue