Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Rails and Rack

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

Rails and Rack

社内勉強会で発表した際の資料です。

Avatar for yachibit

yachibit

June 12, 2018
Tweet

More Decks by yachibit

Other Decks in Technology

Transcript

  1. Rackとは? Rack provides a minimal interface between webservers that support

    Ruby and Ruby frameworks. ref: http://rack.github.io/ ・WebサーバーとRubyやRubyフレームワークとの間のインターフェースを  ミニマルにしてくれるもの ・WebサーバーとRubyフレームワークをつなぐ規約を定義している
  2. Rackに準拠したアプリケーションの規約 To use Rack, provide an "app": an object that

    responds to the `call` method, taking the environment hash as a parameter, and returning an Array with three elements: - The HTTP response code - A Hash of headers - The response body, which must respond to each ref: http://rack.github.io/ ・1つのHashオブジェクトを引数に取る `call` というメソッドが実装されていること ・`call` メソッドは、「ステータスコード, ヘッダーを表現したHash, eachに反応するオブ ジェクト」の3つの要素を持つ配列を返すこと
  3. 参考 - rack/rack: a modular Ruby webserver interface - Rack:

    a Ruby Webserver Interface - Rails on Rack — Ruby on Rails Guides - 翻訳 - Rackとは何か - Qiita - Rails開発におけるwebサーバーとアプリケーションサーバーの違い(翻訳) - Qiita - Rack解説 - Rackの構造とRack DSL - Qiita - パーフェクト Ruby on Rails