Check out a free preview of the full Building Applications with Vue & Nuxt course

The "Deploy the App" Lesson is part of the full, Building Applications with Vue & Nuxt course featured in this preview video. Here's what you'd learn in this lesson:

Sarah creates a remote Github repository for the application. Sarah then deploys the remote repository to Netlify and configures the AWS environment variable.


Transcript from the "Deploy the App" Lesson

>> The next thing that we're gonna do is we're going to deploy and set up some environment variables. So we're gonna deploy. What we're gonna use for nuxt generate, what we're is called nuxt generate. And as I mentioned before, this is new, it newly sets up dynamic routing for you.

In order to deploy it, what I'm gonna do is I'm going to, am I in the right place, I need to make a new tab. And I'm in next food app. I'm gonna use that tool I mentioned in the beginning of the class that's called hub to create GitHub repos on my command line.

So I can say hub, create if I wanted it to be public, I could say just hub create and it will use the name of the directory. But in this case I'm gonna make it private. I'm gonna say dash p. And it will do its magic, it's updating origin.

If you're not using nuxt, you would have had to run git init first, but nuxt will assume that eventually you want to create a git repository. So will already install that, it will already do that for you, which is pretty cool. So I'm gonna do my normal git add a git commit, dash m, initial, commit.

And then git push, dash u, origin master. So now it's compressing, getting everything done. It's gonna push it up, Awesome. So now I can go to gives me a little link here. Now I can go to nuxt food app and I've got a private repo. Yay, and now I'm gonna log into Netlify, I login here.

And I'm gonna say new site from Git, GitHub. I'm gonna make a relationship you could do Git lab as well. Authorised Okay, usually this closes but let's try it again. Cool. And I think I called it nuxt food app. What did I, is that what I called it?

What do I call it? Nuxt food app. Okay. And it's thinking, there it is. I grab that. We're gonna go from the master branch, And again, if you're ever confused as to what your build command is you can go over to your README file or your README at the base.

And it says, install dependencies yarn dough and then serve with hot reload at yarn Dev. And then we've got these yarn build yarn start and yarn generate is for a static project, that's what we're gonna do. So I go over, back over to here, my build command is yarn generate.

My public directory is dist, and we're gonna deploy the site. Now this first deploy, don't worry about it. We're not going to, it's going to be okay, but it doesn't have the environment variable yet. Remember, we didn't, we're not pushing up that dotenv. So what we need to do is we need to go into the settings and we need to go to build and deploy and then we go down to where the environment variables live.

And I need to go back over to my env file and grab that key, and I need to name it the same. I need to name it, AWS API key. So edit variables. I'm going to paste this in here. I'm using a Chrome extension I built called phi masker.

It just masks in case I'm working with sensitive information in front of people. AWS, API, key, save, okay. Now I'm gonna go over here and this is gonna fail at first, don't worry. What we're gonna do is we're going to go to the deploys, and I'm going to say retry deploy.

So it's gonna start up, and we'll come back to this in a second to see how it did. Cool. All right, let's look at what's next. And we can also change the name inside of Netlify as well. So actually maybe we should change the name. Let's do that.

We go over to Site Settings and it gives you this wonderful Carson something or other and I'm just gonna call it food app. Nuxt food app, frontend masters because I already did nuxt food app before. So we're gonna save that and we're working on the building, cool.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now