Created
April 13, 2014 12:01
-
-
Save higuma/10581075 to your computer and use it in GitHub Desktop.
Rack解説 - Rackの構造とRack DSL ref: http://qiita.com/higuma/items/838f4f58bc4a0645950a
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use Rack::ETag | |
| use Rack::Deflater | |
| use Rack::Static, urls: [''], root: 'public', index: 'index.html' | |
| run lambda {|env|} # run proc {|env|} も可 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GATEWAY_INTERFACE = CGI/1.1 | |
| HTTP_ACCEPT = text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 | |
| HTTP_ACCEPT_ENCODING = gzip,deflate,sdch | |
| HTTP_ACCEPT_LANGUAGE = ja,en;q=0.8,en-US;q=0.6 | |
| HTTP_CONNECTION = keep-alive | |
| HTTP_HOST = localhost:9292 | |
| HTTP_USER_AGENT = Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/33.0.1750.152 Chrome/33.0.1750.152 Safari/537.36 | |
| HTTP_VERSION = HTTP/1.1 | |
| PATH_INFO = / | |
| QUERY_STRING = | |
| REMOTE_ADDR = 127.0.0.1 | |
| REMOTE_HOST = localhost | |
| REQUEST_METHOD = GET | |
| REQUEST_PATH = / | |
| ...以下略... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Rack::Directory <-> Rack::Deflater <-> Rack::ETag <-> (Rack handler/server) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Rack::Static.new(app, options = {}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use Rack::Static, urls: [''], root: 'public', index: 'index.html' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use MIDDLEWARE1 [, ARG, ...] | |
| use MIDDLEWARE2 [, ARG, ...] | |
| ... | |
| run ENDPOINT.new [ARG, ...] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app = ENDPOINT.new([ARG, ...]) | |
| ... | |
| app = MIDDLEWARE2.new(app [, ARG, ...]) | |
| app = MIDDLEWARE1.new(app [, ARG, ...]) | |
| Rack::Handler::[SERVER_NAME].run(app, ...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| PATH_INFO = /foo/bar | |
| QUERY_STRING = abc=xyz | |
| ... | |
| REQUEST_PATH = /foo/bar | |
| REQUEST_URI = http://localhost:9292/foo/bar?abc=xyz | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| run ShowEnv.new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| endpoint <-> middleware[s] ... <-> (Rack handler) <-> (server) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment