From 180f4b8ed33fc8fd00729c6600a43bae92e921dc Mon Sep 17 00:00:00 2001 From: martind2000 Date: Mon, 18 Jan 2016 00:15:21 +0000 Subject: [PATCH] add a get route --- routes/temp.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/routes/temp.js b/routes/temp.js index ff5fb12..f33b4b7 100644 --- a/routes/temp.js +++ b/routes/temp.js @@ -70,12 +70,14 @@ router.get('/', function(req, res, next) { insertTempReading(now.toJSON(),parseFloat(req.query.temp) ); closeDB(); - res.writeHead(200, {"ContentType": "application/json"}); - //res.send(JSON.stringify(t)); - res.end(JSON.stringify(t)); + res.writeHead(200, {"ContentType": "text/html"}); + //res.send(JSON.stringify(t)); + res.end('ok'); } else { - res.render('temp', { }); + res.writeHead(200, {"ContentType": "text/html"}); + //res.send(JSON.stringify(t)); + res.end('error?'); } @@ -129,9 +131,9 @@ console.log('C'); } - res.writeHead(200, {"ContentType": "application/json"}); + res.writeHead(200, {"ContentType": "text/html"}); //res.send(JSON.stringify(t)); - res.end(JSON.stringify({})); + res.end('ok'); });