Reading/Web/Setting up a node app
Appearance
- Setup an instance using the instructions in Reading/Web/Setting up a staging environment
- Ensure you set the proxy to look at port 8080
- The default install is setup with an extremely old version of npm. Follow these instructions to use a newer version (I suggest version 6)
- If you need nvm setup following instructions https://github.com/nvm-sh/nvm#installation-and-update - remember to run source .profile after.
- Install `forever` this will reboot your node app when the server goes down:
sudo npm install forever -g
- Set the default node port to 8080. Add this to ~/.profile
export PORT=8080
- Run the app forever:
> screen > forever app.js > mylog.log & [ctrl+a+d]