Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with images #16

Open
walpec opened this issue Nov 29, 2020 · 1 comment
Open

Problem with images #16

walpec opened this issue Nov 29, 2020 · 1 comment

Comments

@walpec
Copy link

walpec commented Nov 29, 2020

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

@Iswell
Copy link

Iswell commented Dec 23, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants