I am new to using Heroku and finding that a specific set of images that worked fine locally show broken links on my deployed app. The console error is "Failed to load resource: the server responded with a status of 404 (Not Found)"
The app is a vanilla Js app with Immutable JS and a Node Express server that consumes data from the Nasa Mars Rover api.
My server makes a Get request on click and fetches data and an array of images for 3 Mars Rovers. As the Nasa api didn't include images of the actual rovers themselves, just the images taken by the rover, I found images for each one, stored in my local assets folder and displayed through the api calls like so-
<img src='https://mars-rover-dashboard-app.herokuapp.com/public/assets/images/${
roverData.rover.get("name") + ".png"}' alt='rover image' class='sidebar__main-rover-img'>
I've researched the problem, and thought it could be because it refers to a path that only exists locally, and not on the Heroku app itself. I added in the url of my Heroku app, and it still doesn't work. Not really sure what else to try?
Via Active questions tagged javascript - Stack Overflow https://ift.tt/XYsceB0
Comments
Post a Comment