nodejs-mysql-links icon indicating copy to clipboard operation
nodejs-mysql-links copied to clipboard

Problem with images

Open walpec opened this issue 4 years ago • 1 comments
trafficstars

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

walpec avatar Nov 29 '20 13:11 walpec

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.

Iswell avatar Dec 23 '20 01:12 Iswell