React + Node Heroku deployment

Hey. I’m trying to deploy my React frontend + node.js backend to heroku, but it doesn’t work. Currently it gives an error

``
Uncaught SyntaxError: Unexpected token ‘<’

manifest.json:1 Manifest: Line: 1, column: 1, Syntax error.

``
Can you please help me deploy it as I am out of ideas how to fix it? Repo - GitHub - VasVV/RussianWeatherApp

Hi,

From express.static()

// where to look for files linked in the html 
app.use(express.static('public'))

//now see the get requests to the server
http://localhost:3000/images/kitten.jpg
http://localhost:3000/css/style.css
http://localhost:3000/js/app.js
http://localhost:3000/images/bg.png
http://localhost:3000/hello.html

Those are looked up under /public, for example /public/images/kitten.jpg

In your case, you’re requesting to: /RussianWeatherApp/<myFilePath> Your server is adding that to the static path, i.e

The solution is writing:

app.use('/RussianWeatherApp', express.static(path.join(__dirname, '../weathermapru/build')));

instead, and you will see the app loading. That sets the root for the file, basically, it changes the /RussianWeatherApp part to /.


Edit: I’ll probably push some simple changes to your project later today. It looks good.

1 Like

Thanks a lot! After changing according to your advice and some additional tinkering with the server part I’ve finally made my app to work.

Any your commits will be very much appreciated especially considering SVG part of my app, as I have 0 experience with svg.

Thanks again and Happy New Year!

1 Like