Adding time object
This commit is contained in:
parent
dafc52aa09
commit
6a915c0ef6
|
@ -1,3 +1,5 @@
|
||||||
# valenBisiFilter
|
# valenBisiFilter
|
||||||
|
|
||||||
A filter for the valenbisi api to make it better for IOT
|
A filter for the valenbisi api to make it better for IOT
|
||||||
|
|
||||||
|
use nodemon for development :0
|
||||||
|
|
12
index.js
12
index.js
|
@ -15,6 +15,12 @@ let returnObject;
|
||||||
returnObject = o;
|
returnObject = o;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
let time = {
|
||||||
|
seconds: pad(new Date().getSeconds(), 2),
|
||||||
|
minutes: pad(new Date().getMinutes(), 2),
|
||||||
|
hours: pad(new Date().getHours(), 2)
|
||||||
|
};
|
||||||
|
returnObject.time = time;
|
||||||
return returnObject;
|
return returnObject;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -45,5 +51,11 @@ function requestData(){
|
||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function pad(n, width, z) {
|
||||||
|
z = z || '0';
|
||||||
|
n = n + '';
|
||||||
|
return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
|
||||||
|
}
|
||||||
// Listen for incoming requests and serve them.
|
// Listen for incoming requests and serve them.
|
||||||
app.listen(process.env.PORT || 3000);
|
app.listen(process.env.PORT || 3000);
|
||||||
|
|
Loading…
Reference in New Issue