daily log
So today, I have to do some data science work. HOWEVER, because I am LEARNING and ITERATING not just over fun python code, but iterating over MYSELF, I’m learning I need to carefully document everything I’ve done in order to appropriately pick up where I left off last time.
Also, to add this (or an abridged version, like the recipe and not the zillion words about my childhood before the actual recipe) to the README
See also 2019-10-11-browswerjournal
SO. Yesterday. CONCLUSIONS:
- Use a python lambda. (Started watching Python AWS Lambdas on youtubes)
- App successfully sending too large of a payload when run in safari PRO: I think this means the request is going through CON: This is not good and I need a better way, duh.
I still need to break this all down into smaller parts.
TO REPLICATE EXACTLY WHERE YOU WERE:
- yarn start in browser-journal
- Open localhost in safari
- Perform upload and watch it fail with a 413 PAYLOAD TOO LARGE
RECENT ADDITIONS TO REACT:
handleUpload = ev => {
let myFile = this.uploadInput.files[0];
console.log(myFile);
const url = "http://localhost:4000/simple_uploader";
axios.post(url, myFile).then(response => {
console.log("RESPONSE-- upper");
});
const bj_aws =
"http://browserjournalserver.s3-us-west-2.amazonaws.com/BrowserHistory_20191010";
const url2 = "http://localhost:4000/send_json_to_python";
axios.get(bj_aws).then(response => {
console.log("RESPONSE1", response);
axios.post(url2, response).then(response => {
console.log("RESPONSE2", response.data);
});
});
};
RECENT ADDITIONS TO NODE SERVER:
var express = require('express')
var cors = require('cors');
var app = express()
app.use(cors())
app.use(express.json()) // for parsing application/json
app.use(express.urlencoded({ extended: true })) // for parsing application/x-www-form-urlencoded
app.use('/simple_uploader', function(req, res) {
// console.log('REQ', req)
res.send(req.body)
// const spawn = require("child_process").spawn;
// const pythonProcess = spawn('python',["./controllers/get_num_kitties.py", req.body, "cheese"]);
// pythonProcess.stdout.on('data', (data) => {
// // toString() is V important lol!!
// // console.log('data from appjs', data.toString(), jdata)
// res.json(data)
// });
})
app.use('/send_json_to_python', function(req, res){
console.log(req.body)
// const spawn = require("child_process").spawn;
// const pythonProcess = spawn('python',["./controllers/get_num_kitties.py", req.body, "cheese"]);
// pythonProcess.stdout.on('data', (data) => {
// // toString() is V important lol!!
// console.log('data from appjs', data.toString())
// res.json(data.toString())
// });
// res.send(req.body)
// res.json(req.body)
})