This is most likely a repeated question.
The closest I got to an answer was here: execute a Nodejs script from an html page?
Yet, I still can't understand.
So here's the situation:
I have an express server setup with the following files:
- Express App
server.js index.html
and right now I want the html folder to have a button, that calls a function set in the node.js file.
Tell me if more information is needed, thanks!
EDIT: Im remaking the question to be more clear.
I am using an express server to present a website, that present a button saying " Power Off", I want this button to be able to execute an action on my server computer, that action being a terminal command to power it off.
I wanted to know how could I make said button, written in HTML, hosted on the server but presented to the client, to interact with the server.js file hosted on the server, which would have a function set to execute said command.
thanks!
<%=foo()%>
` would be how I'd do it in ASP/.Net for example ("calling a `C#` or `VB` `foo()` function") in HTML (view)...skipping "extra" Ajax calls (it's rendered without extra client-side call). I'd be interested in learning too.... – EdSF Sep 01 '16 at 21:26