I have a web application and on button click I want to run node mand. Instead of executing node mand on mand line, trying to execute it on click of button from front end. ex:- I have a web application and on button click I want to run node mand. Instead of executing node mand on mand line, trying to execute it on click of button from front end.
ex:
$( ".button_class" ).on( "click", function() {
//execute mand like : node app.js
});
I have a web application and on button click I want to run node mand. Instead of executing node mand on mand line, trying to execute it on click of button from front end. ex:- I have a web application and on button click I want to run node mand. Instead of executing node mand on mand line, trying to execute it on click of button from front end.
ex:
$( ".button_class" ).on( "click", function() {
//execute mand like : node app.js
});
Share
Improve this question
asked Apr 1, 2019 at 5:58
Alok KumarAlok Kumar
451 silver badge8 bronze badges
2 Answers
Reset to default 5You can not run node mand line on client side as you mention. But alternatively you can make api and hit that api on button click. In that api you can run mnad with.
I am giving you link. that can help you to run mand line with node.
https://www.npmjs./package/node-cmd
Use the package called node-cmd
, install it with npm npm i node-cmd
.
Documentation link: Documentation