ivanceras / svgbob

Convert your ascii diagram scribbles into happy little SVG
http://ivanceras.github.io/svgbob-editor/
Apache License 2.0
3.83k stars 108 forks source link

Added Docker example creating a REST API, improved install instructions #87

Closed winternet-studio closed 2 years ago

winternet-studio commented 2 years ago

What weird attitude is that?? Why is it a problem using PHP? It's just two simple lines of code and the user doesn't have to worry a thing about PHP!! But if you can do it just as easily in Rust why don't you just rewrite it then?!

ivanceras commented 2 years ago

So, I just made svgbob_server to be used in a REST api without using needless dependencies.

I closed this PR because I don't see it as a good engineering practice. You essentially used apache2 server to receive the request and pass them into PHP module. The PHP module extracts the input ascii diagram and save them into a hardcoded physically file which will be overwritten by a subsequent request while the previous request is still reading them. Finally you invoke a CLI from PHP to execute svgbob cli and finally the result is sent to the client.

Why not just use svgbob as a library and use server library such as axium, warp, hyper to extract the request body and process the input ascii diagram right there and sent back to the client in one small self contain executable.

No need for apache2, php module, and physical files.

winternet-studio commented 2 years ago

Ok, that's even better! I just didn't know how to do that :) I did what I knew - which was working just fine in normal conditions. But thanks for the more optimal solution!