Last active
July 24, 2020 21:03
-
-
Save louismullie/c801e483e5d0b9b0cb57c33b8dc97fb9 to your computer and use it in GitHub Desktop.
Example D3-Node-R stack
This file contains hidden or 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 R = require('r-script') | |
const express = require('express') | |
const app = module.exports = express() | |
app.use(app.router) | |
app.get("/dashboard", function (req, res, next) { | |
res.send("Some HTML with D3.js code") | |
}) | |
app.post("/api/meta", function(req, res, next) { | |
const result = R("./scripts/meta.R").data().callSync() | |
res.send({ status: 200, response: result }) | |
}) | |
// Start listening on port 3000 on localhost | |
app.listen(3000, "localhost") | |
console.log("[ OK ] Listening on port 3000") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment