- Online video game shopping website that uses RAWG.IO API for video game data, where you can view the catalog and add items to your cart.
- React routes
- React hooks
- React props
- Handling inputs and rendering lists
- Calling third-party APIs
- Storing API Keys with Create React App
-
the first issue had to do with the build environment.. updating the
Build command
fromnpm run build
toCI=false npm run build
worked in solving the build issues on Netlify -
Attempting to use Netlify's serverless function
- API call not working on server, but working on local
- I spent many hours trying to figure out why my API calls were working on my local development environment and not on Netlify. I followed the freeCodeCamp Netlify tutorial linked in the resources, and my project worked locally using
netlify dev
. However, I ran to issues when deploying my project on netlify. - By following the freeCodeCamp tutorial, I created a
.js
file innetlify/functions
so Netlify knows where to locate my functions. And, I used try-catch with axios.get for the API call. This worked locally, but caused issues on the server. I ended up commenting out the code in the.js
file innetlify/functions
and usedfetch
instead ofaxios
directly in the component I was working in. I also setapi key
in.env
the REACT way, and the API call ended up working both locally and on Netlify.- I learned more about serverless functions and was able to get the functions working properly locally by following this and this tutorial
- adding
netlify.toml
and renaming thenetlify
folder to.netlify
- by following the tutorials step by step, I was able to build up my knowledge and get my APIs working properly with the serverless functions
- it seems that most of the local errors had to do with syntax such as using
/.netlify/functions
instead of./netlify/functions
and running the local server onlocalhost:8888
and notlocalhost:3000
- adding
- I learned more about serverless functions and was able to get the functions working properly locally by following this and this tutorial
-
third party API calling using serverless functions is not working.. trying to fetch/axios into
/.netlify/functions/gif-get
isn't working properly- the data comes out in some unreadable form
- axios into
/.netlify/functions/helloWorld
does work and the data is readable
- style
- test app using React Testing Library