0% found this document useful (0 votes)
65 views

Deploying Heroku App

The document provides instructions for deploying a Node.js app to Heroku. It involves creating a Heroku account, installing the Heroku CLI, specifying a start script in package.json, initializing a Heroku git repository, committing code changes and pushing the code to Heroku to deploy the app. Key steps include running commands like 'heroku create', 'git push heroku master' and 'heroku open' to deploy and run the app on Heroku.

Uploaded by

salnasu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views

Deploying Heroku App

The document provides instructions for deploying a Node.js app to Heroku. It involves creating a Heroku account, installing the Heroku CLI, specifying a start script in package.json, initializing a Heroku git repository, committing code changes and pushing the code to Heroku to deploy the app. Key steps include running commands like 'heroku create', 'git push heroku master' and 'heroku open' to deploy and run the app on Heroku.

Uploaded by

salnasu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Deploying a Node.

js App to Heroku
1. Create a ​Heroku account​ (free).
2. Install the ​Heroku CLI​ (Command Line Interface) to use the ​heroku​ command to create,
monitor, and deploy your Heroku app (usually requires internet connection).
3. In your ​package.json​, specify the node script to run on the server (similar to the one
you would run in the command line locally, but use ​node​ instead of ​nodemon​). To do
so, add ​"start" : "node <app-file-name>"​ to the ​"scripts"​ as seen on line
8 below:

4. Initialize your Heroku repository. Just like Gitlab, Heroku makes use of git to manage
your files. However, we need to create this repository first.
a. Open your terminal in your project directory (type ls to make sure your files are
there) and type ​git init​ to create the necessary files for managing the Heroku
repository.
b. For the first time you create a Heroku app, run ​heroku login​ to authenticate
your user/pass locally. ​This is a one-time step. ​Note that if you are using
Windows and get stuck at the login screen, you may need to use the Windows
Command Prompt instead of Git Bash. See Appendix at bottom of this document
for equivalent screenshots.
c. Run ​heroku create​. This will tie your local repository to Heroku and allow you
to push your files.
d. Add your files (but not any ​node_modules​ - these will be installed on Heroku
using your ​package.json​) with ​git add​ and then commit with ​git commit
-m “commit message”​.
5. Push the repository to heroku with ​git push heroku master. ​A link will be printed
to the terminal once your site is online. This is the URL to your web service (and you can
also ​fetch​ from it!) To easily open within the current directory, run: ​heroku open​.
Appendix: Screenshots using Windows Command Prompt
To find the Command Prompt:

Screenshots of equivalent steps using Command Prompt in main document:

You might also like