On my website, I host an express app that hosts a different port than what is hosted by Namecheap, which is what I am using for hosting. Right now I’m just hosting the express app in the terminal in cPanel for testing, but when I release the site this way won’t be acceptable.
Is there a way I could host my express app without my computer always being on and hosting it manually?
2
Answers
Install pm2 as global dependency in your hosting server.
After that go to app directory and run.
It will run your application forever until some error may not occur.
You can build a docker image of your app and run the docker container forever or use process managers like pm2 or forever to run your app in detached mode.