In the last section we finish up the first half of our first time deployment checklist.
We created our Heroku account.
We committed our code base code base to a good repository and then we installed the Heroku CLID.
So at this point in time you should be able to flip over to your terminal and run the command Heroku
dash fee and see some version information pop out again if you're seeing an error message change over
to the human discussion boards.
And let me help you fix this.
OK so now we've got the Rocha's Seelye.
We can use it to create a new app.
Now let's first use it to create the app and we'll talk about exactly what this app thing is.
So the command line we're first going to log into our instance of Heroku by running Heroku log in like
so after you run that command you should be prompted to enter your Heroku credentials.
And so this is the email and password that you just created your Hoku account with.
I've already signed in to my local Heroku Seelye so I'm not going to go through that process.
But if this is your first time using Heroku you definitely will want to next.
We will use the command line to create our new app so we'll run the command Brochu create like.
Now after just a second or two we're going to see some output that contains two separate links.
The first link that we see on here is with the nav that are in the first link is the address that will
navigate to whenever we want to visit our application inside the browser.
And so inside of here you'll see some randomly generated name for our application.
In my case I have ADD gyle by you 6 5 to 6 so you very likely will have some completely different string.
This string right here identifies the name of your application to Heroku.
The second link is the link that we really care about.
In our case this second link right here is our deployment target.
It is a good repository that we can push our local server to.
So we already committed our codebase and last section right we installed it.
We created a new get repository and we committed our entire codebase to that repository.
We are now going to push that repository to this remote repository that is managed by Heroku.
The instant we push our repository to this remote one Heroku will take that as a signal that it needs
to deploy our application and started up automatically.
So we're now going to move on to the second to last step where we deploy our app with get.
First we're going to make sure that we set up a remote get repository using the second link right here.
So I'm going to copy the entire link and then I'll press command C to copy the link then at my command
line I will execute get remotes add Heroku and then I'll paste the link.
This command right here says add a remote repository to our current repository to the one that we just
created inside the server directory.
We want to name that remote link or that remote repository as Heroku.
And this is the address of that remote repository.
So I'll run this command and you might see something that says her remote Heroku already exists.
If you do that's totally fine.
Otherwise you might not see any output at all if the command successfully ran.
OK so now we can use this to actually deploy our application.
We're going to run the command get push Heroku master.
So this says take all the code that we have committed to our local repository and push the master branch
to the Heroku repository which exists at this you are l over here.
So I run this command and then the instant we do we should see a little bit of debug information pop
up.
And so all this remote stuff this remote message that you see right here is all feedback that is provided
by Heroku directly.
And so Heroku is going to attempt to build our application.
It's going to automatically detect that we are making use of no G-S that's going to set a couple of
different runtime flags.
It's then going to install the versions of node NPM that we specified inside the package not just on
file.
It will then install all of our dependencies which are listed inside the package not just on file and
then it's going to essentially finish up the deployment.
And so hopefully going to see a message that says something like build succeeded.
Now at the very end we should see some it says like verifying deployment done and then the final success
message that says the repository was successfully push to this remote location.
OK now I'm going to say right now that at this point hopefully everything works and the application
should be working.
However it's incredibly likely and very possible that you might have some small issue.
So the first thing we're going to do is test out our application and see if it's working.
When we test this out if it doesn't work that's totally fine.
Do not panic.
Keep watching this video and I'll show you exactly how you can debug what's going on and try to figure
out a solution.
OK.
So the first thing we're going to do is test out our application and see whether or not it is working
successfully.
So at the command line we'll run the command Heroku open like so now when we run this command it will
automatically launch a new browser window and navigate to our deployed project.
So for me it automatically visits my remote deployment target of agile by you and I see the message.
Hi there appear on the screen which is currently what we are sending back to anyone who makes a request
to the route route of our express application.
And so if you see this right here you see just like plain text that says Hi there.
Awesome.
That's fantastic.
It means you successfully deployed the application.
If you see some message that says like hey something went wrong here or some Heroku message that's totally
fine.
Again let's go through the steps to debug this.
So if you saw any error message that's totally fine.
Flip back over to your terminal and run the command Heroku logs.
Now when you run this command Heroku will automatically give you some output that was generated by the
deployment process.
And so hopefully you will see some error message in here that might give you a little bit of insight
into exactly what went wrong during the deployment.
Do your best to try to figure out what's going wrong.
Feel free to google for some more error message or some follow up or some help on troubleshooting.
But of course if you're having any issue or you see any error message inside of here.
Always feel free to post something inside the to me discussion boards.
And again I'll do my best to help you out.
Now I do have to say if you see an error message and you make a post over on the discussion boards asking
for help please please please take a screenshot of the error message that you see and post it on to
me so I can see exactly what's going wrong.
If you don't if you just say Hey it don't work something's wrong I can't help you right.
You got to tell me what's going wrong so please make sure you include a screenshot.
OK so anyways.
Hey.
On the plus side you know something went wrong.
OK that's fine we'll figure it out but if everything went according to plan we have now deployed our
brand new brand spanking new Express application.
You can now take the R L right here and you can share with all your friends and they will be able to
see your application as it develops over time throughout this course.
Now do keep in mind that we're only going to deploy the application at some very specific intervals
when everything is kind of working and ready to be deployed so there might be some points in time at
which it's not the best to like share with your friends because it might be broken but you know we'll
work through it over time.
OK so that's pretty much it.
At this point we're going to end this video.
We still have not gone through the process of doing subsequent deploys But after we make our next change
our codebase we will do a second deployment and we'll talk about how we do another follow deploy.
What I do want to tell you is that when you attempt to deploy our application again you do not need
to create another application.
OK.
Make sure that's really clear.
So if you want to redeploy the application or follow up a second time we'll go through the next batch
of steps right here which will cover in a few short video.
OK.
That's pretty much it.
Let's continue in the next section and start adding some additional features to our back and server.
So I'll see you in just a second.