Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on dashboard page #3

Open
Tegos opened this issue Mar 15, 2018 · 2 comments
Open

Error on dashboard page #3

Tegos opened this issue Mar 15, 2018 · 2 comments

Comments

@Tegos
Copy link

Tegos commented Mar 15, 2018

After login, if reload page Dashboard on enter manually http://localhost:3000/dashboard the page does not work.
image

@zhabinsky
Copy link

zhabinsky commented Jan 15, 2019

@Tegos I resolved it this way:

  1. we change the route for all the statics like this:

app.use ('/static', express.static ('./server/static/'));
app.use ('/static', express.static ('./client/dist/'));

  1. then we add another route that allows for access of index.html from ANY route.
app.use ('/*', express.static ('./server/static/'));
  1. Because in ExpressJS the ORDER of specified routes MATTERS we need to take the line from step 2 and put it below any other routes (So as not to silence them, expressjs will take first matching route and use it).
...

app.use ('/api', apiRoutes);

app.use ('/*', express.static ('./server/static/')); // Paste this line after the one above
  1. And finally change paths for resources in index.html.
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Hey there!</title>
    <link rel="stylesheet" href="/static/css/style.css">
  </head>
  <body>
    <div id="react-app"></div>
    <script src="/static/js/app.js"></script>
  </body>
</html>
  1. Done, try accessing /dashboard directly.

happy coding!

@Tegos
Copy link
Author

Tegos commented Jan 16, 2019

@zhabinsky thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants