add a get route
This commit is contained in:
parent
159c2208de
commit
180f4b8ed3
@ -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');
|
||||
});
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user