When I close putty after running 'serve -s build' session stops and my React app stops working
Hello! I created a small React application using create-react-app. I want to deploy this app on Linux server, so I use the command npm run build, which creates 'build' folder. Then I move 'build' folder to server and use the command serve -s build. The app works fine, but there's the problem - when I close putty (which I use to connect to my server) session closes and React app stops. I tried to use the command like this serve -s build &, but that doesn't help and every time I close the session the app stops
Could you please help and clarify what is the right way to deploy React app on server? How to make it work even when I close putty?
Thanks for your time
Thanks to the comment by Konrad I finally realized that the problem was not with the React command, but in running processes in background mode. Using serve -s build & and nohup serve -s build > f1.txt &
didn't help, but when I started searching for the right terms I found this answer here.
This link helped a lot as well.
So after reading the articles my steps were:
nohup serve -s build > f1.txt &
jobs -l
*the id of my process was 1*
disown %1