0

I seem to be having a path issue that is causing my app to not load the home route correctly. I've spent a whole day trying different ways of building my path in my node/express server home route such that it will actually load on heroku but to no avail.

I've used to heroku cli to verify my dist folder and the bundled items it contains are in the right location on the server and that i'm pointing correctly at it, yet the problem remains. I'll include a link to the stack overflow post I've already made.

any help is greatly appreciated. What little information I could find (different techniques for building the whole file path, setting the heroku config to development instead of production mode so that my dev dependancies are used) has not worked at all.

https://stackoverflow.com/questions/60677247/node-application-with-webpack-deployed-to-heroku-home-route-not-found

1 Answer 1

0

Unless we know the directory structure, we cannot comment much but as best practice I would suggest to use_dirname and path to construct the path of the file you want to send rather than hard coding the path.

Example:

res.sendFile(path.join(__dirname, '../dist', 'index.html'));

Or

res.sendFile('index.html', { root: path.join(__dirname, '../dist') });
2
  • Hello and thank you for your response. I tried both of these methods for building the path. Unfortunately, neither seemed to work in my case. Commented Mar 14, 2020 at 21:07
  • Does it work Iocally?
    – manjit5190
    Commented Mar 15, 2020 at 6:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .