Getting started with Lotus::Router
On yesterday I've open sourced Lotus::Router: an HTTP router for Ruby. It's fast, lightweight and compatible with the Rack protocol.
It implements a beautiful DSL.
This example shows how to getting started with it.
require 'lotus/router'
Application = Rack::Builder.new do
router = Lotus::Router.new do
get '/', to: ->(env) { [200, {}, ['Hello World']] }, as: :root
end
run router
end.to_app
To run it:
rackup application.rb
If you're wondering how to write integration and unit tests, here the complete example: https://gist.github.com/jodosha/8594998
Written by Luca Guidi
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#