nodejs-mysql-links
nodejs-mysql-links copied to clipboard
Problem with images
Everything is working ok but the logo and the background. All is like the example code but I can't figure why the background and logo image are not showing up. Any help or tip in order to resolve thisissue?
Thanks
The solution is to move the express.static middleware before the router. To make sure the 'public' directory is called before the 'routes' directory. As explained here: https://stackoverflow.com/questions/20718244/nodejs-express-cant-find-public-folder
The same thing happened to me and I solved it like that.
The main index.js file should end like this:
// Public app.use (express.static (path.join (__ dirname, 'public')));
// Routes app.use (require ('./ routes')); app.use (require ('./ routes / authentication')); app.use ('/ links', require ('./ routes / links'));
// Starting the server app.listen (app.get ('port'), () => { console.log ('Server on port', app.get ('port')); });
Hope this can help you.