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 trial

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
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.