Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Do I Execute System Scripts from Within a Reactjs Project?

I have a React project where I want to execute a server side bash script when a user clicks a button. This script would then run and return some output to be displayed back to the user. I know that NodeJS has a way to spawn or exec a particular command, but I'm not sure how I can take advantage of these features inside my React project.

Does anyone know how to accomplish this?

like image 862
Kyle s Avatar asked Jan 30 '23 11:01

Kyle s


1 Answers

What you can do is create a web service, that you will call with your React JS application. This web service will execute the script directly on the server and when it's done you can return data to display on your React JS application.

like image 76
fandro Avatar answered Feb 01 '23 22:02

fandro