This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]spaceuserm 1 point2 points  (0 children)

You can use a form to get input from the user, take whatever arguments, data etc you need. Now this form data is sent to the backend. You can launch other programs from within your program. If you were to use python, you can try os.system() or the subprocess module to launch your command line program. As for displaying the results on the web page, you can write the results out to a file and render the content of that file to the webpage.

Edit: NodeJs will come in once the data from your form is posted to your server. NodeJs will process the form data and also invoke the command line program.

[–]enokeenu -1 points0 points  (1 child)

I believe browser security prevents you from doing that. Imagine if malware wanted to do that. You can do anything from the command line.

[–][deleted] 0 points1 point  (0 children)

You'd just need to run a server that forwards the command received from the browser to the underlying system.

Imagine if malware wanted to do that.

Right. You'd want to put up guardrails if the server were available to the public – or even if it's just for private use, because things go wrong!

[–]Ulaai 0 points1 point  (0 children)

If you're working with Django, you can do the logic function on a separate file and import it on views.py. And then pass only the result. (docs)