This page is also available in English. å§ããã Sinatraã¯Rubyã§ä¸è¨ã®ãããªæå°å´åã§ææ©ãã¦ã§ãã¢ããªã±ã¼ã·ã§ã³ãä½æããããã®DSLã§ãã # myapp.rb require 'rubygems' require 'sinatra' get '/' do 'Hello world!' end gemãã¤ã³ã¹ãã¼ã«ãã¦åããã¦ã¿ãã sudo gem install sinatra ruby myapp.rb localhost:4567 ãè¦ãã ã«ã¼ã Sinatraã§ã¯ãã«ã¼ãã¯HTTPã¡ã½ããã¨URLãããã³ã°ãã¿ã¼ã³ããã¢ã«ãªã£ã¦ãã¾ãã ã«ã¼ãã¯ãããã¯ã«çµã³ä»ãããã¦ãã¾ãã get '/' do .. ä½ãè¦ãã .. end post '/' do .. ä½ãçæãã .. end put '/' do .. ä½ãæ´
ã¯ããã« Rubyã®æ®åã«ã¨ããªããRubyã®çã¿ã®è¦ªã§ãããã¾ã¤ãã¨ããã²ãæ°ãCè¨èªã§ä½æããRubyã¤ã³ã¿ããªã¿ï¼CRubyï¼ä»¥å¤ã«ããJVMã§å®è¡ãããJRubyãObjective-Cã§å®è£ ããMacã¢ããªã±ã¼ã·ã§ã³ã®ããã°ã©ãã³ã°ã®ã§ããMacRubyãCRubyãã¼ã¹ã«ã¡ã¢ãªç®¡çã«æ¹è¯ãå ãã¦ããRuby Enterprise Editionçãããã°ã©ãã³ã°è¨èªRubyãå®è¡ã§ããç°å¢ãå¢ãã¦ãã¾ãããã¾ãCRubyã«é¢ãã¦ããç¾å¨æã使ããã¦ãããã¼ã¸ã§ã³ã§ãã1.8系以å¤ã«ããææ°ã®å®å®çã§ãã1.9ç³»ãæ®åæã«ã¯ãã£ã¦ãã¾ããã ä»åã¯ãè¤æ°ã®Rubyå®è¡ç°å¢ã®ç®¡çãç°¡åã«ããRVMï¼Ruby Version Magagerï¼ãç´¹ä»ãã¾ãã RVMã¨ã¯ RVMã¯UNIXç³»ã®ç°å¢ã§ãè¤æ°ã®Rubyå¦çç³»ãã¤ã³ã¹ãã¼ã«ãå ±åããããã¨ãã§ãããã¼ã«ã§ãã ã²ã¨ã¤ã®ç°å¢ã«å¯¾
ã¯ããã« Web APIã使ã£ã¦æ§ã ãªãµã¼ãã¹ã¨é£æºããã¨ããã¢ã¼ããã¯ãã£ã¯ãã£ããå®çããæãããã¾ããã¿ãªããããWeb APIã使ã£ã¦ãã¼ã¿ãããã¨ãããã¢ããªã±ã¼ã·ã§ã³ãæ¸ãæ©ä¼ãå¢ãã¦ããã®ã§ã¯ãªãã§ããããã Web APIã使ãã¢ããªã±ã¼ã·ã§ã³ã®éçºã§ã¯ããã¹ãããããã°ãããéã®APIã¢ã¯ã»ã¹ãæ©ã¿ã©ããã¨ãªãã¾ããæ¬ç©ã®ãµã¼ãã使ã£ãã®ã§ã¯ãã¹ããã¼ã¿ã®åæåãªã©ã«æéããããã¾ãããéã«HTTPã¢ã¯ã»ã¹èªä½ãã¹ã¿ããã¢ãã¯ã使ã£ã¦éæ¥åãã¦ãã¾ãã¨ãããæ¬å½ã«æå¹ãªãã¹ããªã®ãä¸å®ãæ®ã£ã¦ãã¾ãã¾ãã çè ããä»äºããã©ã¤ãã¼ãã§ã®ã³ã¼ãã£ã³ã°ã§ãã®ãããªæ©ã¿ã«ä½åº¦ãééãã¾ããããããã解決ããããã«éçºããã®ãwwã§ãï¼wwã¨æ¸ãã¦'double-web'ã¨èªã¿ã¾ãâ ï¼â ã ããã¼Webãµã¼ãä½æã©ã¤ãã©ãªww(Double Web) wwã¯ãWebãµã¼ãã¹ã®ç°¡å
ã¯ããã« Sinatraã¯Rubyã§è¨è¿°ãããWebã¢ããªã±ã¼ã·ã§ã³ãç´ æ©ããç°¡åã«ã¤ããããã®DSLï¼ãã¡ã¤ã³åºæè¨èªï¼ã§ãã ãã§ã«ç¬¬7åã§ãåæ ããã«ãããå°è¦æ¨¡Webã¢ããªã®ããã®ãã¬ã¼ã ã¯ã¼ã¯ãSinatraãã¨ããããã¡ã§ç´¹ä»ããã¦ãã¾ãã ç°¡æ½ãªææ³ã§ãé«ã表ç¾åãæã¤Sinatraã¯ãã¢ã¡ãªã«ã®Rubyã³ãã¥ããã£ãä¼æ¥ãä¸å¿ã«ãç¬ãéã«ã¦ã¼ã¶ãå¢ããã¾ãããã¾ããRubyã¨ããä¸è¨èªã«çã¾ãã[1]â ãSinatraã模ãããã¬ã¼ã ã¯ã¼ã¯ãå¤ãä½ããã¦ããç¾ç¶ããããSinatraã¯Webã¢ããªã±ã¼ã·ã§ã³éçºãã®ãã®ã«ã大ããªå½±é¿ãä¸ããã¨è¨ãã¾ãã æè¿ã§ã¯ããæ¥æ¬ã§ããå人å©ç¨ãä¸å¿ã«ããããããã§Sinatraã使ã£ã¦éçºããã¦ãããã¨ãã話ãèãããã«ãªãã¾ãããçè èªèº«ã1ã¦ã¼ã¶ã¨ãã¦ç¾å¨æ¥åã§å©ç¨ãã¦ããã1å¹´åã¯ç¥ã人ãç¥ãåå¨ã ã£ãSinatraã¯ãå®éã«
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}