DEV Community

Discussion on: Deploying a React (with Redux)/Rails app with Netlify/Heroku

Collapse
 
sharkham profile image
Sam Markham • Edited

Hey Huy, congrats on getting the frontend of your app up, and sorry you've run into issues with the backend!

The biggest issue I ran into when I was deploying was that Heroku takes a little while to load, so when I logged in/signed up it would take a few for my database to boot up and actually process this.

How is your login/signup not working? Is your backend deployed to Heroku alright, and can you navigate to some of your JSON endpoints there to check it's working? (e.g. [back-end-url]/api/v1/trainers/1, that sort of thing?)

Collapse
 
huyddo profile image
Huy Do

Do I just only need to run the app by using "wow-frontend.netlify.app"? Here are my REACT_APP_BASE_API_URL = wow-backend-api.herokuapp.com and FRONT_END_URL = wow-frontend.netlify.app. Are they correct? I can see my characters from wow-backend-api.herokuapp.com/api/....

Thread Thread
 
sharkham profile image
Sam Markham

Those look correct for your URLs, and both of those sites look like they're running! For the URLs, I would double check that this is exactly the path you were using in the development/local version of the app, like, if your API url in the frontend used to be "localhost:3000/api/v1" make sure your API url in production is "your-domain.herokuapp.com/api/v1" etc.

Thread Thread
 
huyddo profile image
Huy Do • Edited

Hi Sam,
wow-backend-api.herokuapp.com/api/... is showed users data in the seed file.
and localhost:3000/api/v1/players is showed the recent users data which are stored in pgAdmin.

Example: Here is my fetchPlayer.js from frontend

const apiURL = process.env.REACT_APP_BASE_API_URL
export function fetchPlayers() {
return (dispatch) => {
fetch(${apiURL}/api/v1/players) //Inline code has back-ticks around it.
.then(resp => resp.json())
.then(players => dispatch({
type: 'FETCH_PLAYERS', payload: players
}))
}
}

Thanks,