A Web application framework for Web servers that support mruby and Rack-based API.
mruby-hibari currently supports the Web servers below:
Write once, run the same on any servers above.
class MyApp < Hibari::App
def build
res.code = 200
res.headers["content-type"] = "text/html; charset=utf8"
res.body.push("Hello, World!")
req.params.each do |k,v|
res.body.push("#{k}: #{v}")
end
end
end
MyApp.new.run
hibari do
res.code = 200
res.headers["content-type"] = "text/html; charset=utf8"
res.body.push("Hello, World!")
req.params.each do |k,v|
res.body.push("#{k}: #{v}")
end
end
- Add dependency on mruby-hibari into the build_config.rb in your mruby installation.
- Write mruby handler like above.
git clone
at h2o/deps to embed mruby-hibari:cd h2o/deps && git clone https://github.com/kentaro/mruby-hibari
- Write mruby handler like above.
Read-only accessor to ENV
passed from Web server.
Builds URI and returns it as URI
object (See https://github.com/zzak/mruby-uri for details).
Parses query string and returns it as Hash
object.
(This method currently does nothing about decoding or other; it just splits the query string with &
and =
)
Shortcuts to env[XXX
].
Accessor to HTTP response code.
Accessor to HTTP response headers.
Accessor to HTTP response body.
Returns an array that follows Rack's spec.
Kentaro Kuribayashi
MIT