最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Execute Node command on button click - Stack Overflow

programmeradmin1浏览0评论

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
Add a ment  | 

2 Answers 2

Reset to default 5

You 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

发布评论

评论列表(0)

  1. 暂无评论