Trying to POST canvas drawing to server

I've made a basic drawing application using p5, that uses an ellipse as a brush which accumulates every frame because the background doesn't clear. Ideally, once the user's done, they press a submit button the image would POST to a json object in an mlab database (cloud mongoDB service). Is this even doable? If I understand, save() only downloads to the user's computer? I'm new to back end dev so go easy. Simplified code below.

function setup() {
    let canvas  = createCanvas(1200, 1200);
    canvas.parent('js-sketch-holder');
    background(0);
    noStroke();
    fill(255);
    rect(100, 100, 1000, 1000);
    brush = new Brush(50, defaultSwatch);
    createPallet();
}

function draw() {
    renderPallet();
    //ellipse brush accumulates on canvas
    brush.display(mouseX, mouseY);
}

Answers

Sign In or Register to comment.