Here are the steps to be followed to get the API running on the Server.
- npm init to create a package.json file
-
install packeages
- "dependencies": { "cors": "^2.8.5", "express": "^4.18.1" }, "engines": { "node": "16.13.2" }
- Crete index.js file for the express to run on server
- add the json file and import it on index.js file
-
create Procfile
- simply add web: node index.js
- Now it's time to set the Heroku CLI to deploy our api live. For more details on heroku cli please watch this video wihtout skip:
- Once Heroku cli setup simply login using heroku login, then type the following commands to host api live on server
- git init
- git add .
- git commit -m "your msg"
- heroku create
- git push heroku master