I have a node app that works locally and uses Express for routing. I have tried to set this up on digital ocean using their guide. I can see the home page of my app when I navigate to /, but I cannot access any inner pages.
To debug I stopped the app running through pm2 and simply ran it by calling 'node app.js' in the terminal so that I can see the console log messages.
I put comments on Express routes for testing:
app.get('/', function (req, res) {
console.log('/ route requested');
if (req.isAuthenticated()) {
res.render('home',
{
user: req.user
});
} else {
res.render('home',
{
user: null
});
}
});
app.get('/signup', function (req, res) {
console.log('/signup route requested');
res.render('signup');
});
When I request '/' the console log message is printed. However trying to visit '/signup' nothing is shown in the terminal. I am taken to a default 404 page (nginx/1.10.0 (Ubuntu).
Also the index page isn't loading resources from my public directory, such as styles.
I would appreciate any help trying to get the Express routes and resources to load on the remote server. Please let me know if their is further information that would be helpful for debugging.
via Paul Trotter
No comments:
Post a Comment