diff --git a/lib/pushToMongo.js b/lib/pushToMongo.js new file mode 100644 index 0000000..6ef2acc --- /dev/null +++ b/lib/pushToMongo.js @@ -0,0 +1,8 @@ +import axios from "axios" + +export async function pushToMongo(data){ + let response = await axios.post('http://metaforecast-twitter-bot.herokuapp.com/utility-function-extractor', { + data: data + }) + console.log(response) +} \ No newline at end of file diff --git a/pages/index.js b/pages/index.js index 2619b55..e9b4778 100644 --- a/pages/index.js +++ b/pages/index.js @@ -8,6 +8,7 @@ import { DisplayElement } from '../lib/displayElement' import { DisplayAsMarkdown } from '../lib/displayAsMarkdown' import { CreateTableWithDistances } from '../lib/findPaths' import { TextAreaForJson } from "../lib/textAreaForJson" +import { pushToMongo } from "../lib/pushToMongo" let increasingList = (n) => Array.from(Array(n).keys()) let buildLinks = quantitativeComparisons => quantitativeComparisons.map(([element1, element2, distance]) => ({ source: element1, target: element2, distance: distance })) @@ -223,6 +224,7 @@ export default function Home({ listOfElementsDefault }) { setSliderValue(0) if (successStatus) { let jsObject = nicelyFormatLinks(quantitativeComparisons, listOfElements) + pushToMongo(jsObject) console.log(jsObject) } }