Run Ruby on Sinatra/Rails app using Cloud9 IDE

# Run Ruby on Rails/Sinatra app on Cloud9 IDE

I spent hours trying to run up a Ruby web server using Sinatra on Cloud 9. The cloud9 IDE instructions on the Output screen say:

Your code is running at [http://project-name.username.c9.io]
Important: use ‘ruby app.rb -p $PORT -b $IP’ to run your server apps!

Problem:

None of above doesn’t work! There is no solution on cloud9 documentation!

In fact, these are the instructions for a Rails application, and the -b switch is invalid for Sinatra applications, which I figured out when using the terminal window!!!
“Error: you may be using the wrong PORT & HOST for your server app!” – Cloud9 yellled!

Solution:

For rails, You should type:
$  rails server -p $PORT -b $IP’
=> Your rails app will UP and Running!
For make your Sinatra applications UP and Running type in the console:

$  ruby app.rb -p $PORT -o $IP

And that’s fixed! Check and star my gist.

“Try not to become a person of success, but rather try to become a person of value.” —Albert Einstein

 

 

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s