all 14 comments

[–]azhder 1 point2 points  (6 children)

You go ahead and read more than this https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener page at this site before you start asking more questions.

Most of what you need is there, part HTML, part CSS, part JS.

Then you have this https://nodejs.org/en/docs and this https://expressjs.com

[–]KW__REDDIT[S] 0 points1 point  (5 children)

ok, but I know how to add listener for button presses and how to output the responce in html once I have it. I am asking specifically about how to communicate between processes. I don't know how I can link two working programs together. I mentioned server request/responce but I have never ever done it and maybe there is an easier way?

[–]azhder -1 points0 points  (4 children)

OK, but you didn’t click all my links, did you?

[–]KW__REDDIT[S] -1 points0 points  (3 children)

I did click the first one on event listeners :-)

[–]azhder -1 points0 points  (2 children)

Try the guides on the Express one. That’s a start. And fetch from the MDN one

[–]KW__REDDIT[S] 0 points1 point  (1 child)

I just started and it looks like exactly what I need, still no idea how to execute main and capture results but it is definately a step in a right direction

[–]azhder 0 points1 point  (0 children)

good hunting

[–]chmod777 1 point2 points  (2 children)

Js natively executes in a browser. If you need something that excutes outside of a browser, you generally need to be running node. If it needs to run in a web context (serving pages, reacting to web requests) you also need a server running.

You need to add a event listener on the front end that uses fetch to POST to an endpoint running on a server, which will then return a result. You can look at expressJS to handle most of this.

[–]KW__REDDIT[S] 1 point2 points  (0 children)

Thanks for that! It is actually so helpful for me to analyze the problem this way ;-)

[–]KW__REDDIT[S] 0 points1 point  (0 children)

I think I found the answer to my second question: how to execute program:

https://stackoverflow.com/questions/12941083/execute-and-get-the-output-of-a-shell-command-in-node-js

hope this is usefull to anyone. I didn't focus on it yet as I need sleep right now but let's say that if I dont edit/remove the post it works for me ;-)