Sha256: 72a34fb8d3435530dc893c5818eb1ba0ab0b1b4b08864ba8ca06cca25b8495c2
Contents?: true
Size: 974 Bytes
Versions: 3
Compression:
Stored size: 974 Bytes
Contents
#!/usr/bin/env rackup -p 4000 -s thin # encoding: utf-8 require "rango" require "rango/mixins/mini" Rango.boot Rango::Router.use(:urlmap) # 1) Basic Rack way how to return response map("/about/version/1") do # setup Content-Length and Content-Type headers # (both these middlewares are included in Rango::Dispatcher), # so you can also do use Rango::Middlewares::Basic # use Rack::ContentLength # use Rack::ContentType use Rango::Middlewares::Basic run lambda { |env| [200, Hash.new, "Rango version: #{Rango::VERSION}"] } end # 2) Rack way how to return response via Rack API # You can use Response#status= and Rack#[]= if you need to setup status resp. headers # http://rack.rubyforge.org/doc/classes/Rack/Response.html map("/about/version/2") do run lambda { |env| Response.new("Rango version: #{Rango::VERSION}").finish } end # 3) Rango-specific way map("/about/version/3") do run app { |request, response| "Rango version: #{Rango::VERSION}" } end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rango-0.0.6 | examples/flat/basic.ru |
rango-0.1.pre | examples/flat/basic.ru |
rango-0.0.4 | examples/flat/basic.ru |