add a get route

This commit is contained in:
martind2000 2016-01-18 00:15:21 +00:00
parent 159c2208de
commit 180f4b8ed3

View File

@ -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');
});