-
-
Save chrisseaton/ac78e3a193929ba6473f24eb188ae443 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const app = express() | |
const BigInteger = Java.type('java.math.BigInteger') | |
app.get('/', function (req, res) { | |
var text = 'Hello World from Graal.js!<br> ' | |
// Using Java standard library classes | |
text += BigInteger.valueOf(10).pow(100) | |
.add(BigInteger.valueOf(43)).toString() + '<br>' | |
// Using R interoperability to create graphs | |
text += Polyglot.eval('R', | |
`svg(); | |
require(lattice); | |
x <- 1:100 | |
y <- sin(x/10) | |
z <- cos(x^1.3/(runif(1)*5+10)) | |
print(cloud(x~y*z, main="cloud plot")) | |
grDevices:::svg.off() | |
`); | |
res.send(text) | |
}) | |
app.listen(3000, function () { | |
console.log('Example app listening on port 3000!') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment