Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Build a Simple Dynamic Site with Node.js Handling Routes in Node.js User Route

Thomas Santoro
Thomas Santoro
4,007 Points

User route fails - 502 Bad Gateway

https://w.trhou.se/315t9v851d

Snapshot above. Two questions: (1) The home route works fine, but my user route consistently gives me the bad gateway error. Can't seem to spot the error. (2) Why doesn't the console kick back an error on this? Thanks for any help!

Thomas Santoro
Thomas Santoro
4,007 Points

For context, this is what a Microsoft webpage says about this error. It doesn't make sense: why would the treehouse site not fail for my Home route but would for my User route, especially since i can still do the 'ol https://teamtreehouse.com/username.json thing and it works fine. I'm still missing both the what and the why of this problem...

"The 502 Bad Gateway error is usually a network error between servers, meaning the problem is not with your computer or internet connection. The error may be temporary. Try refreshing the webpage or re-enter the address in the address bar and check. Trying to reload the page often fixes the issue. Since the 502 Bad Gateway error message is an issue with the web site's network, there could be a technical glitch from the server. You may want to wait for a while before loading the website."

Hello, Your "username.length" is incorrectly written..