This is a playground to test JavaScript. It runs a completely standard copy of Node.js on a virtual server created just for you. Every one of npm’s 300,000+ packages are pre-installed, so try it out:
var got = require("got");
exports.endpoint = function(req, res) {
var URL = process.env.URL;
got(URL, {responseType: 'json'}).then(response => {
var json = response.body;
var diff = (new Date() - new Date(json.status + 'T00:00:00+03:00'))/1000/60/60;
json.color = diff > 24+24+6 ? "red" : "green";
return json;
}).then(response => {
res.end(JSON.stringify(response));
});
};