Posts

Showing posts with the label Coding

Run Remote Code on Server with pm2

Image
Run Remote Code on Server with pm2 - Simple There are Broadly two types of code:- 1. CRON based (a code which run itself after sometime continuously) 2. Server based Now,     # Deploying Backend Code Steps: 1. Clone the Repository using https. 2. Checkout to your preferable branch. 3. Install all dependencies using npm i 4. Configure pm2 and start the server.  that's all! Process: 1. git clone "https://......" 2. git checkout "branchName" 3. npm i 4. pm2 start "Entry point file path" --name "server name"     For example if your entry point file is app.js then the above command will look like - pm2 start app.js --name backend Tips  * Use command pm2 list to track your recently started server and it's pm2 ID. * Use command pm2 logs "pm2 ID" to check the logs for any error/s.   # Deploying Frontend Code Steps: 1. Clone the repository using https. 2. Checkout to your preferable branch 3. Install all dependencies using npm i 4. Run t...