Using the application provided in your assigned repository, you will walk-through the following steps to host your application on Heroku.
- Fork this repository and pull down the contents to your local machine. Install the necessary dependencies need to run the application. The package.json file has already been created and identifies the packages your repository will depend upon.
- Start the server and make sure you are able to create and delete grocery items.
Listed below are a few steps that will help you accomplish adding an Update button
- Navigate to the app.js file and replace the statement
const port = 3000
withconst port = process.env.PORT || 3000
. It is important to make this change so that the application server is started on a random port on the cloud. If you hard code a port number, like in all Getting Started guides, and deploy to the cloud, the specific port number may not be available. The application will never start. So it’s better to get the port number assigned by the cloud instance and start the HTTP server.
Make sure your branch is clean prior to pushing up changes. Make sure the changes you made to the app.js are properly reflected in your remote repository.
-
Navigate to Heroku.com and create a new account
-
Click New on the top right corner and select "Create a new app"
- A debit/credit card is needed, but I would encourage you to delete the application and close your Heroku account if you do not plan to use beyond this course.
- Make sure to register for the GitHub Student Developer Pack and click on this link to receive a credit that is worth $13 a month for 12 months
- Heroku will ask for debit/credit card information to create an app, but listed below is a statement from Heroku that explains how a charge would occur.
- We won’t charge you at this time. Heroku resources are prorated to the second, and you only pay for the resources you use.
-
Provide an app name and click Create app.- Consider a name that represents your application
-
Once you have completed this step, you'll be taken to the dashboard of your app. Open the deploy tab and scroll to the "Deployment method" section.
-
Select GitHub as the method
-
It will show a “Connect to GitHub” option where we can provide our GitHub repository. If you are doing it for the first time, Heroku will ask permission to access your GitHub account.
-
Open the settings tab and scroll down to the Domains and certificates section to find the URL for your application.
- Adjust the README.md file at the end to include 1) the date of completion, 2) course information and 3) the Heroku URL
- Comment your name to the app.js file and
- Make sure your master branch is clean and push up your final changes.
- In Sakai, submit 1) the URL to your repository and 2) the URL to your Heroku application