aaaand removing the headers to check if it works better
This commit is contained in:
parent
1fbb8a6ace
commit
52aa2837df
|
@ -75,7 +75,7 @@ gpower = new JustGage({
|
||||||
id: "gauge",
|
id: "gauge",
|
||||||
value: 0,
|
value: 0,
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 60000,
|
max: 30000,
|
||||||
title: " ",
|
title: " ",
|
||||||
label: "Watt",
|
label: "Watt",
|
||||||
showMinMax: false
|
showMinMax: false
|
||||||
|
|
|
@ -116,22 +116,12 @@ app.use(flash());
|
||||||
|
|
||||||
|
|
||||||
app.get('/api/spaceapi/v13', function (req, res) {
|
app.get('/api/spaceapi/v13', function (req, res) {
|
||||||
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
||||||
res.setHeader("Cache-Control", "no-cache");
|
|
||||||
res.send(spaceanswer);
|
res.send(spaceanswer);
|
||||||
});
|
});
|
||||||
app.get('/api/simple/v2', function (req, res) {
|
app.get('/api/simple/v2', function (req, res) {
|
||||||
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
||||||
res.setHeader("Cache-Control", "no-cache");
|
|
||||||
res.send(simpleanswer);
|
res.send(simpleanswer);
|
||||||
});
|
});
|
||||||
app.get('/api/usercount', function (req, res) {
|
app.get('/api/usercount', function (req, res) {
|
||||||
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
||||||
res.setHeader("Cache-Control", "no-cache");
|
|
||||||
|
|
||||||
//TODO: respect query params "start", "end", "interval" (s) and "limit" (like Xively)
|
|
||||||
// maybe skip "interval" if code gets too complex :)
|
|
||||||
|
|
||||||
ippoll.getHistory("-inf", "+inf", function (data) {
|
ippoll.getHistory("-inf", "+inf", function (data) {
|
||||||
usercountanswer.datapoints.length = 0;
|
usercountanswer.datapoints.length = 0;
|
||||||
usercountanswer.at = simpleanswer.lastchange;
|
usercountanswer.at = simpleanswer.lastchange;
|
||||||
|
@ -139,12 +129,8 @@ app.get('/api/usercount', function (req, res) {
|
||||||
usercountanswer.datapoints = data;
|
usercountanswer.datapoints = data;
|
||||||
res.send(usercountanswer);
|
res.send(usercountanswer);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
app.get('/api/simple/image', function (req, res) {
|
app.get('/api/simple/image', function (req, res) {
|
||||||
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
||||||
res.setHeader("Cache-Control", "no-cache");
|
|
||||||
|
|
||||||
if (spaceanswer.state.open == true) {
|
if (spaceanswer.state.open == true) {
|
||||||
res.sendfile(path.resolve(__dirname, 'public/img/green.png'));
|
res.sendfile(path.resolve(__dirname, 'public/img/green.png'));
|
||||||
} else if (spaceanswer.state.open == false) {
|
} else if (spaceanswer.state.open == false) {
|
||||||
|
@ -158,8 +144,7 @@ app.get('/db', routes.db);
|
||||||
app.post('/form', routes.form);
|
app.post('/form', routes.form);
|
||||||
app.get('/', routes.index);
|
app.get('/', routes.index);
|
||||||
|
|
||||||
|
server.listen(3000, 'localhost');
|
||||||
server.listen(3000, '0.0.0.0');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue