我正在尝试开发基于机架的Web应用程序
config.ru 是
"name"
home.html 是
use Rack::Static,
:urls => ["/images", "/js", "/css"],
:root => "Rack"
run lambda { |env|
[
200,
{
'Content-Type' => 'text/html',
'Cache-Control' => 'public, max-age=86400'
},
File.open('home.html', File::RDONLY)
]
}
和ruby文件 Rack.rb 是
<form action="Rack.rb" method="get">
name: <input type="text" name="name"><br>
age: <input type="text" name="age"><br>
<input type="submit" value="Submit">
</form>
输出
require 'rack'
require 'rack/server'
class HelloWorld
def response
[200, {}, ['Hello World']]
end
end
class HelloWorldApp
def self.call(env)
HelloWorld.new.response
end
end
Rack::Server.start :app => HelloWorldApp
我需要解析GET请求的输入。怎么做?