skip to Main Content

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


  1. Install pm2 as global dependency in your hosting server.

    npm i pm2 -g
    

    After that go to app directory and run.

    pm2 start app.js --name "name of your app"
    

    It will run your application forever until some error may not occur.

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search