Save canvas element as image in static website

I have a static website where users can go through a set of questions. At the end of each round, I want to store the result that is in a div as an image.

I was able to use html2canvas to convert the div into an image. I was also able to show the image in the page. But I would like to store these images. What’s the best way to do it? I tried this approach.

I set up a very simple node.js API server with a POST endpoint. The parameter to this endpoint is the canvas.dataURL() string which I will store as an image file in the server.

The problem I am facing is that this string is very long and I get a 413 error when I test my API. What’s the best way to work around this?