Fetching data from strapi, with gatsby app deployed to netlify - heroku

I am building a web app with Gatsby and are having trouble figuring out how to fetch data from the deployed Strapi-app. Gatsby is deployed to Netlify, Strapi deployed to Heroku. (I have no trouble fetching data when running both projects locally)
I appreciate all the help and useful advice!
EDIT:
Found one solution to this problem. In gatsby-config.js -> gatsby-source-strapi; set apiURL = "process.env.API_URL || 'http://localhost:1337'", and made a new file called ".env.development" in the root folder and typed in "API_URL='your-heroku-app'"
I am sure there exist a similar solution to use when it is not in development-mode.

We explain how to deploy both Strapi on Heroku and Gatsby on Netlify in this tutorial: https://strapi.io/blog/building-a-static-website-using-gatsby-and-strapi#11deploygatsbytonetlify
I hope it will provide the answer to your question :)
Cheers!

Related

Django REST + Vue3 deployment with Passenger

I have a local app with a Django backend and Vue3 frontend, and I have to deploy it to a Dreamhost Shared Host. I've already deployed the backend with Django and Passenger and it's working (the admin panel and its API is working), but now I need to add the frontend side to the server.
I've followed the instructions to deploy a Vue app, generating the dist folder with npm run build and then adding it to my public folder in the server, but nothing happens. I can't find any tutorial or anyone trying to build something similar, so any help to understand what I should have to do is welcomed.

Why doesn't my website stop loading (Svelte)

I made a portfolio website, but this site doesn't stop loading.
Sorce code is here.
Does anyone have a solution? or the reason why this happens?
Deploy only your bundled static files. I can access your entire svelte project under your domain. check the sources tab in your browser's DevTools.
since you use vercel for deployment, check this out.
https://github.com/vercel/serve
Check for service workers (If you are using them)
But more probably
2) ALWAYS npm run build before firebase deploy

Deceptive site ahead

I have the next error: "Deceptive site ahead". My app is separate in frontend with Angular 8 and backend with Laravel 5.8. The issue is when I deploy the backend to a subdomain (services), Google Chrome shows me that error. What's wrong?
I've done the same with another easy Laravel project and it's fine, but I don't know why it happens in this project.
I hope someone helps me and sorry for my English.
Nothing to do with your code. Google has blacklisted/marked as unsafe your site for some reason which can harm users. If it is not done by you then you may have some script or file on your server which google has found and thinks it is unsafe. After clearing your files you may try to submit for review.
Check here more detailed information: https://www.malcare.com/blog/deceptive-site-ahead/

Debug Gatsby site on Netlify

My portfolio is made on Gatsby and deployed to Netlify. It works fine locally but there are bugs on the live site on Netlify. How can I debug this? I cannot use console.log and there are no console errors. How can I debug this?
The issues are to do with a component that shows based on whether a hook is true and the image doesn't render through childImageSharp
If it's being hosted on Netlify, all it is doing is running gastby build and then serving the site up from the public folder. You should be able to run gatsby build && gatsby serve locally to mimic the issue you're seeing on your deployed site. If you can't reproduce it, try cleaning out your .cache and public folders with gatsby clean.

REACT create-react-app server setup: GET works but POST returns 404 with same URL

For learning purposes, I'm building out the Official React Tutorial, inside the official create-react-app build environment. It's almost all working, except for one problem:
The JQuery POST is returning a 404 error, while GET is working. This is on the same URL. It means I can't get the final step in the tutorial working: saving a comment to the JSON file....
I think it's in the server setup under create-react-app. Anyone have experience getting this working in the create-react-app environment?
Thanks!
By the way... here's a repo of the project
https://github.com/seanrasmussen/react-tutorial-in-create-react-app
I got an answer for this from the official create-react-app team. I'm paraphrasing:
The create-react-app is not set up for doing GET/POST like the original tutorial server setup. So, the tutorial won't work right. If you put the test data on a valid API server and use that URL then it should work...

Resources