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.

Ruby Building Web Apps with Sinatra Your First Sinatra App Multiple Routes in the Same App

Localhost cannot be found by browser when running ruby produce.rb in workspace.

I am using Windows 10 and running the ruby server in workspace, the browser says it cannot reach the page.

1 Answer

Jay McGavren
STAFF
Jay McGavren
Treehouse Teacher

localhost should only be used when you're running Sinatra directly on your development computer. When using Treehouse Workspaces, you should not type the host address into your browser bar manually. Instead click the "Preview Workspace" icon in the workspace menu bar (looks like an eye), and then choose whatever port your app is running on (port 4567, in the case of a Sinatra app). A new window will then open with the preview. Treehouse creates a special host name for each workspace you preview, and the only way to find out this host name is through the "Preview Workspace" menu.

After the preview opens, then you can add paths like /apple and /carrot onto the end of the URL. But don't change the address itself!

You'll find additional troubleshooting help in the teacher's notes on this video: Sinatra - Your First App.