Skip to content
Snippets Groups Projects
Commit c4900219 authored by Sami Spets's avatar Sami Spets
Browse files

Added a way to find out the 'depth' of configuration

parent 8047ba16
No related branches found
No related tags found
No related merge requests found
Pipeline #15170 passed
...@@ -223,13 +223,31 @@ app.post('/stream/config', async (req, res) => { ...@@ -223,13 +223,31 @@ app.post('/stream/config', async (req, res) => {
}) })
app.get('/stream/config', async(req, res) => { app.get('/stream/config', async(req, res) => {
//example of uri /stream/config?uri=ftl.utu.fi/stream/calibrations/ //example of uri ftl.utu.fi/stream/config?uri=ftl://utu.fi/stream/calibrations/
//example of uri /stream/config?uri=ftl.utu.fi/stream/calibrations/board_size/value=1 //example of uri /stream/config?uri=ftl://utu.fi/stream/calibrations/board_size/value=1
const uri = req.query.uri const wholeURI = req.query.uri
const uri = wholeURI.substring(13)
const depth = uri.split("/");
console.log(wholeURI)
console.log(uri) console.log(uri)
console.log(depth)
//const listOfCongifs = await Config.find({}); switch(depth.length){
return res.status(200).json(uri) case 1:
console.log('DEPTH 1')
return res.status(200).json('DEPTH IS 1, RETURNING EVERYTHING');
case 2:
console.log('DEPTH 2')
return res.status(200).json('DEPTH IS 2, RETURNING ALMOST EVERYTHING');
case 3:
console.log('DEPTH 3')
return res.status(200).json('DEPTH IS 3, RETURNING BIT LESS');
case 4:
console.log('DEPTH 4')
return res.status(200).json('DEPTH IS 4, RETURNING SINGLE VALUE');
default:
console.log('DEPTH ERROR')
return res.status(200).json('Error');
}
}) })
//app.get('/stream', (req, res)) //app.get('/stream', (req, res))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment