-
Notifications
You must be signed in to change notification settings - Fork 4
PadrinoでHelloWorldをしてみる
mechamogera edited this page Aug 31, 2012
·
2 revisions
PadrinoでHelloWorldなプロジェクトを作成してみる
- ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
- padrino (0.10.7)
- 前準備
gem install padrino
- プロジェクト作成
padrino project g hoge
- bundle install
cd hoge
bundle install
- lib作成
mkdir lib
vi lib/moge.rb
# => 以下の内容にする
class Moge
def self.hello
"hello world"
end
end
- コントローラ作成
bundle exec padrino g controller hoge
vi app/controllers/hoge.rb
# => 以下の内容に変更
Hoge.controllers :hoge do
get 'hello' do
Moge.hello
end
end
- サーバー起動とアクセス
bundle exec padrino s
- => http://localhost:3000/hoge/helloにアクセス