OK, I got it working. As promised, I have added instructions below for anyone that might need
Here’s how to deploy your Web3 DEX from the Moralis Full Course Tutorial
-
Push your completed code/project to GitHub (easiest way)
-
Deploy backend first (dexBack). Go to render .com and create an account (You know what to do)
-
Once you are logged in to your dashboard, go to the top right corner, click on “New +”… and select “Web Service”
-
Now connect your GitHub account, find the repository for your DEX and click “Connect”
-
Give your web service a unique name, and follow the rest in the image below:
-
Scroll down and click the Advanced button and add your ENV variables (see image below):
-
Click the Create Web Service button and wait…
-
Once successfully deployed, copy the deployed URL (see image below):
-
Now go back into your VSCode and paste this render URL in the async function fetchPrices… where you have const res = await axios.get(http://localhost:3001/tokenPrice
, {
Replace only the “http://localhost:3001” with your url you copied from render, leaving everything else the same. So it will look something like this: ‘https://my-web3-dex-xhwn.onrender.com/tokenPrice’
Save and push your changes to GitHub.
No more screenshots from here on, but follow along
- Now, go to Netlify sites tab. Let’s deploy the frontend. Go to Add new site button >> Import an existing project >> Connect to GitHub >> Choose your repository from GitHub >> …
OK, one last screenshot (see image below for the rest)
Lastly, also very important BEFORE you hit “Deploy site”. Click the “Show advanced” button, and add the following Environment variables
Key = CI
Value = false
Now, you can click the deploy site and everything should be up and running smoothly.
Hope that helps!
PS: You can deploy your frontend on render .com as well instead of using Netlify, but I just chose to do it this way for now.