Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

rwdw-stats

node v14.20.1
version: 3.0.0
endpointsharetweet
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)); }); };
Loading…

no comments

    sign in to comment