Wednesday 25 April 2018

Single Page App Routing Question

Hello,Not exactly sure which subreddit to ask this question but I believe it may be fitting in the node subreddit.I am creating a single page application using express/react/mongo/node. In my development server, my routing worked flawlessly. I could reload any page and it would load the appropriate content, I could go back and forth in history and it'd be fine.Currently, I'm trying to deploy my app with digitalocean, I've set up an Ubuntu server, installed mongo, node, and all that jazz. The website loads (currently just running it through pm2 on a random port) I can go back and forth and click links. BUT if i reload the page i get the good ol' 'Cannot get /therestoftheurl'My index.js contains the following:app.use(express.static(__dirname + '/public'))And near the bottom:app.get('/', function(req, res){res.sendFile(__dirname + '/public')})Anyone know why this would all the sudden be any issue?

Submitted April 25, 2018 at 10:21AM by dhyd

No comments:

Post a Comment