Tutorial: How to Deploy Node.js backend server on cPanel
In this example my backend listens on a port and connects to mongoDB
[ Ссылка ]
My apologies, Youtube doesn't allow code snippets : (
In the subdomain folder :
.htaccess
*See video for code snippet, also available on A2 Hosting docs
In the node.js app folder:
.npmrc
scripts-prepend-node-path=true
From the terminal:
cloudlinux-selector install-modules --json --interpreter nodejs --user yourusername --app-root yoursubdomainfolder
source /home/yourusername/nodevenv/yoursubdomainfolder/14/bin/activate && cd /home/yourusername/yoursubdomainfolder
npm run start
cron job:
*See video for code snippet
Updating-killing the previous script:
ps faux
kill __________your process id number PID
Backend project for testing: [ Ссылка ]
My Portfolio: [ Ссылка ]
[ Ссылка ]
Best of luck with your own projects
Ещё видео!