5. require 'sinatra/base'
class App < Sinatra::Base
get '/' do
'Hello world!'
end
end
App.run! host: 'localhost', port: 3000
$ gem install sinatra
$ vim app.rb
$ ruby app.rb
$ curl http://localhost:3000/
Example Sinatra App
8. Example Padrino App
module SampleProject
class App < Padrino::Application
register Padrino::Rendering
register Padrino::Helpers
enable :sessions
get '/' do
'Hello world!'
end
end
end
$ vim app/app.rb
$ padrino s
$ curl http://localhost:3000/
9. class App < Sinatra::Base
get '/' do
'Hello world!'
end
end
Sinatra
Comparison App File
Padrino
module SampleProject
class App < Padrino::Application
register Padrino::Rendering
register Padrino::Helpers
enable :sessions
get '/' do
'Hello world!'
end
end
end
10. Philosophy
Simple to use
Simple to hack
Developer freedom
Coding should be fun!
Only have a very few layer
between We and the Padrino.