Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDavid Bonaroti
2,708 PointsTyping 'localhost:3000/login' is taking back to Login screen and not '/profile' screen.
I have all of the code typed exactly correct. After putting in the correct middleware, and then signing in to my Bookworm account, everything looks fine. However when I change '/profile' to '/login', like it does in the demo video, my website actually goes back to the Login screen. Is it not supposed to do that with the middleware code. What am I doing wrong?
I can guarantee I typed all my code correct because I even tried copying and pasting the code from the Completed file bc I couldn't think of anything else I was doing wrong.
Sam Donald
36,305 PointsIt was probably a cache issue.
I was using chrome and having the same issue as you. As soon as I performed an 'Empty cache and hard reload' it came good.
2 Answers
Tom Geraghty
24,174 PointsIf you don't want to have to keep clearing the cache to see changes as you develop an app, you can do a force reload in most browsers by adding Shift to the regular reload command.
For Chrome to reload the current page is Ctrl+r, you can do a force reload of the current page with no cache with Ctrl+Shift+r or Command+Shift+r for Mac.
Andrew Gursky
12,576 PointsSame problem. Then I realized that I had added the middleware function to the POST route rather than the GET route :/. That fixed it.
David Bonaroti
2,708 PointsDavid Bonaroti
2,708 PointsUpdate: I was using Safari and my '/login' was taking me back to Login (should be staying on '/profile'. I switched to Chrome and the website works correctly (i.e.. '/login' when signed in redirects to '/profile'). Why does Safari not work correctly?