From 2738141f2110fceb5248411e622aeed08ef94b49 Mon Sep 17 00:00:00 2001 From: Stefan Sterz Date: Wed, 17 Feb 2016 23:18:54 +0100 Subject: [PATCH] clean up backend routes --- nodejs/routes/index.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/nodejs/routes/index.js b/nodejs/routes/index.js index 464bd03..42fc622 100644 --- a/nodejs/routes/index.js +++ b/nodejs/routes/index.js @@ -13,17 +13,13 @@ router.get('/', function(req, res, next) { res.render('index', { title: 'Express' }); }); -router.get('/toggleLight', function (req, res) { - /*var s = "0FFF0FFF000F"; - var str = ""; - for(i = 0; i < s.length; i+=2) { str += String.fromCharCode(parseInt(s.substr(i,2), 16)); } - arduino.write(new Buffer('Wl' + str,'ascii')); - res.send('switch light');*/ - rc_db.find(1, function (error, results, fields) { +router.get('/getRCs', function (req, res) { + rc_db.findAll(function (error, results, fields) { if(error) console.log(error); - rc.send(results[0].on_value); + //rc.send(results[0].on_value); + res.json(results); }); - res.send('switch light'); + }); router.get('/irTest', function (req, res) {