Drawing to G Code Converter

I’m working on a CNC Plotter Project. I want to make an APP with Canvas, where user will draw something on the canvas and the app will generate G Code for it, then the G code will be sent to ESP8266 board wirelessly. If anybody interested to help me I would be very happy.