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:
Tonic allows you to require multiple versions of the same package, which gives you the unique ability to compare them. Here we'll see what the difference is between ramda 0.9.1 and the latest state of the art:
var Promise = require("bluebird").Promise;
var Readable = require('stream').PassThrough;
var rs = new Readable;
rs.push("beep");
rs.push("boo");
var data = await readAtMost(rs, 10);
console.log(data);
rs.push("boo");
var data = await readAtMost(rs, 100);
console.log(data);
var tonicExpress = require("notebook")("tonic/express-endpoint/1.0.0")
// Just provide the exports object to the tonicExpress helper
var app = tonicExpress(module.exports)
var bodyParser = require('body-parser');
var jsonParser = bodyParser.json();
// Handling Webhooks
app.post("/webhook", jsonParser, (req, res) => {
// Retrieve the request's body and parse it as JSON
//var postData = JSON.parse(req.body);
try {
res.send(JSON.stringify(req.body));
} catch(e) { console.log(e) }
});
// Handling Webhooks
app.get("/webhook2", jsonParser, (req, res) => {
// Retrieve the request's body and parse it as JSON
//var postData = JSON.parse(req.body);
try {
res.send(JSON.stringify(req.body));
} catch(e) { console.log(e) }
});
var transform = require("babel-core").transform;
transform(`
let x = 10;
if (1)
{
ca: let x = 20;
}
`, { plugins: require("babel-plugin-transform-es2015-block-scoping") }).code
Send a request to a URL like https://tonicdev.io/tonic/json-endpoint-example-1/branches/master?url=http://google.com, get back the title of the page in the url query parameter.