This document discusses Sinatra, a Ruby web framework. It provides an overview of Sinatra and demonstrates how to build a simple "Hello World" application. It then shows how to add Haml templating to create views and ActiveRecord to interact with a SQLite database. The examples show creating a model, controller actions to save and retrieve data from the database, and displaying it on a view. In summary, the document presents Sinatra as an easy way to build web applications in Ruby and demonstrates integrating templating and database functionality.
This document discusses Sinatra, a Ruby web framework. It provides an overview of Sinatra and demonstrates how to build a simple "Hello World" application. It then shows how to add Haml templating to create views and ActiveRecord to interact with a SQLite database. The examples show creating a model, controller actions to save and retrieve data from the database, and displaying it on a view. In summary, the document presents Sinatra as an easy way to build web applications in Ruby and demonstrates integrating templating and database functionality.
9. Rack実装
class App
def call(env)
case env[‘REQUEST_METHOD’]
when ‘GET’
[
200,
{ ‘Content-Type’ => ‘text/html’ },
[‘<html><head></head><body>hello</body></html>]
]
end
end
end
引数を1つ持つ
callメソッドを実装
?ステータスコード
?レスポンスヘッダ(Hash)
?レスポンスボディ(Array)
を返す
13年8月19日月曜日