Roda是一个全新的Ruby的Web开发框架,通过使用路由树实现更快和DRY编码。
示例代码:
# cat config.rurequire "roda"class App < Roda use Rack::Session::Cookie, secret: ENV['SECRET'] route do |r| # matches any GET request r.get do # matches GET / r.is "" do r.redirect "/hello" end # matches GET /hello or GET /hello/.* r.on "hello" do # matches GET /hello/world r.is "world" do "Hello world!" end # matches GET /hello r.is do "Hello!" end end end endendrun App.app
评论