ハロの外部記憶インターフェイス

そろそろ覚える努力が必要かも…

Sinatraフレームワークを利用してHello,worldを表示してみる

Sinatraのインストール

$ sudo gem install sinatra

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
Successfully installed sinatra-1.0
1 gem installed
Installing ri documentation for sinatra-1.0...
Installing RDoc documentation for sinatra-1.0...

app.rbの作成

require 'rubygems'
require 'sinatra'

get '/' do
    'Hello, world!'
end

Webサービスの実行

$ ruby app.rb
== Sinatra/1.0 has taken the stage on 4567 for development with backup from Mongrel
127.0.0.1 - - [14/Jul/2010 16:02:43] "GET / HTTP/1.1" 200 13 0.0007
127.0.0.1 - - [14/Jul/2010 16:02:44] "GET /favicon.ico HTTP/1.1" 404 420 0.0009

Browserで確認