Building with Sanity and Nuxt with Ekene Eze
In the previous lesson, we cleaned up the UI to make it look all beautiful and nice. We also implemented dynamic page routes for all the products we have.
What we want to do in this lesson is go ahead and deploy both our Nuxt front end application, and also the sanity application.
So that users can access them from wherever they are in the world.
So let's go back to VS Code pull up our terminal. And do sanity deploy. Let's go into the sanity mission project.
And let's run sanity, deploy.
And let's choose a studio host name of sanity mission.
And now that our sanity application is deployed, it will be available. In this URL. So if we come and click on it. We should be able to open it in the browser.
And there we have our deployed sanity application.
So the next thing we want to do is to go ahead and deploy our front end application. So let's. Go back.
And get into the sanity mission front end directory.
And here. The first thing we want to do is push our projects to Git.
So let's do git init
And let's add all the contents of this project.
And let's commit everything.
Next, let's add the remote.
And let me quickly. Copy that.
So I'm calling it sanity nuxt mission on Github.
And lastly, let's push this.
Let's push to master.
And now that our application is successfully pushed to GitHub. Let's go back and set up our Netlify app.
So select new site from Git.
Select Github. Get it authorized.
And search for the repository that we created, which is Sanity Nuxt. Mission. Select this.
Deploying from the master branch.
Let's change the build command to yarn generate.
dist folder and click on deploy site.
So our site is deployed successfully. The next thing we want to do is change the site name. So that it's a little bit easier to read. Let's call it.
Sanity. Nuxt. Mission. Let's save this.
And now that it's available. We can go to the site and we'll find our application successfully deployed and working as expected. The last thing we want to do to make sure that the request to sanity to goes through at all times is to copy this URL. And add it to manage that. sanity.io. As part of the allowed origins.
Come to settings come to API and go ahead and add this here.
And subsequent requests coming from this origin will always be allowed in sanity. And with this, we have successfully arrived at sanity land. This will be the end of this mission. And I hope to see you in the next one.
Your captain Kenny. Signing out.