with lightness, performance and testability in mind. It aims to bring back OOP to web development, leveraging on stable APIs, a minimal DSL, and plain objects.
to: ->(env) { [200, {}, ['Hello, World!']] } get '/dashboard', to: 'dashboard#index' get '/middleware', to: RackMiddleware get '/rack-app', to: RackApp.new ! redirect '/legacy', to: '/' ! namespace 'admin' do get '/users', to: UsersController::Index end ! resources 'users' end ! Rack::Server.start app: app, Port: 2306
to: ->(env) { [200, {}, ['Hello, World!']] } get '/dashboard', to: 'dashboard#index' get '/middleware', to: RackMiddleware get '/rack-app', to: RackApp.new ! redirect '/legacy', to: '/' ! namespace 'admin' do get '/users', to: UsersController::Index end ! resources 'users' end ! Rack::Server.start app: app, Port: 2306
! private def params(env) env.fetch('router.params') end end ! r = Lotus::Routing::EndpointResolver.new(endpoint: Endpoint) ! Application = Rack::Builder.new do app = Lotus::Router.new(resolver: r) do get '/' do 'Hello, World!' end ! get '/greet/:planet' do |params| "Hello from the #{ params[:planet] }!" end end run app end.to_app
! private def params(env) env.fetch('router.params') end end ! r = Lotus::Routing::EndpointResolver.new(endpoint: Endpoint) ! Application = Rack::Builder.new do app = Lotus::Router.new(resolver: r) do get '/' do 'Hello, World!' end ! get '/greet/:planet' do |params| "Hello from the #{ params[:planet] }!" end end run app end.to_app