'404 When loading navbar on nodejs

I deployed my app to Heroku. I create a login page that created a session variable that is verified in each website to make sure the user is log in before displaying the website.

logIn Code

When the user entered the correct user email and password it creates the session. This is going to show the main page which is business.

get business route

I added the checkSignIn, as a middleware to verified the status of the user.

checkSignIn

When I am using the checkSignIn I am getting the 404.

business with error

If I remove the middleware I get the desired behavior.

enter image description here

To add the navbar I am using the following code:

add navBar

Seems that with the middleware the view is requesting the page to the server instead of just grabbing the html from the assets.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source