Rubyã®ãã¬ã¼ã ã¯ã¼ã¯Sinatraã触ã£ã¦ã¿ã
Rubyã§ãã¬ã¼ã ã¯ã¼ã¯ã¨ããã°ãRailsãæåã§ãããæè¿ããã¨é »ç¹ã«Sinatraã®ååãèãã®ã§ãã¡ããã£ã¨è§¦ã£ã¦ã¿ã¾ããã
å ¬å¼ãµã¤ãã¯ãã¡ãã
ã£ã¦ãã¨ã§ããã£ããSinatraãã¤ã³ã¹ãã¼ã«ããã
$ sudo gem install sinatra
GitHub - sinatra/sinatra: Classy web-development dressed in a DSL (official / canonical repo)ã®ãµã³ãã«ã³ã¼ããæ¸ãã¦åããã¦ã¿ãã
require 'rubygems' require 'sinatra' get '/' do 'Hello sinatra!' end
èµ·åãã¦ã¿ãã
$ ruby hello.rb /opt/local/lib/ruby/gems/1.8/gems/sinatra-0.9.2/lib/sinatra/base.rb:930:in `detect_rack_handler': Server handler (thin,mongrel,webrick) not found. (RuntimeError) from /opt/local/lib/ruby/gems/1.8/gems/sinatra-0.9.2/lib/sinatra/base.rb:862:in `run!' from /opt/local/lib/ruby/gems/1.8/gems/sinatra-0.9.2/lib/sinatra/main.rb:34 from hello.rb:4
ã©ãããthin, mongrel, webrickã®ãããããè¦ã¤ãããªãããã ãã¨ãããã¨ã§ãmongrelãã¤ã³ã¹ãã¼ã«ããã(mongrelãé¸ãã çç±ã¯ç¹ã«ãªã)
$ sudo gem install mongrel
å度起åãã¦ã¿ãã
$ ruby hello.rb == Sinatra/0.9.2 has taken the stage on 4567 for development with backup from Mongrel
以ä¸ã®URLã«ã¢ã¯ã»ã¹ããã¨ãHello sinatra!ã¨åºåãããã
ã¾ãè¿ããã¡ã«ããå°ã触ã£ã¦ã¿ããã¨æãã