Only root route works. /about, /home shows "Cannot GET /home" in browser. If i replace each route path with "/" then the corresponding component is rendering. But there seems to be problem when i try to render certain route eg /home.
Asked
Active
Viewed 3,070 times
1 Answers
1
You have to configure your server to work with Router.HistoryLocation
-- that is, it needs to always serve your index.html page regardless of the route.
app.get('*', function (req, res) {
res.render('index');
});
Check out the docs here: React Router Docs - HistoryLocation

BradByte
- 11,015
- 2
- 37
- 41
-
i got the point, but with my limited knowledge of server configuration, it was hard for me to setup in "gulp-connect" server. I tried looking for other server like nginx, apache but could not find any thus ended up using HashLocation : Router.run(routes, Router.HashLocation, (Root) => { React.render(
, document.body) }); My point of using HistoryLocation was previously i was getting error in HashLocation : "missing )", which i managed to solve by importing "gulp-babel" in my gulpfile. thanks for your help. – rosnk Aug 29 '15 at 07:01 -
I'm using a simple node server with express.. there's a lot of tutorials out there that could provide some more details. – BradByte Sep 01 '15 at 13:27