# Busker An extremely simple web framework. It's called Busker as a reference to Sinatra. It mimics Sinatra in some aspects while still trying to stay a true wanderer of the streets. ## Installation Add this line to your application's Gemfile: gem 'busker' And then execute: $ bundle Or install it yourself as: $ gem install busker ## Usage require 'busker' Busker::Busker.new do # minimal route definition route '/' do "Busker version: #{Busker::VERSION}" end # respond to multiple HTTP methods, overwrite response content_type route '/info', [:GET, :POST, :PUT, :DELETE] do |params, request, response| response.content_type = 'text/plain' request.inspect end # usage of URL params, render template with variable route '/template', :GET do |params| @title = params[:title] || 'no title' if params[:external] render './template.erb' else render :template end end # usage of dynamic route params route '/item/:id' do |params| "requested item with id: #{params[:id]}" end # list all defined routes route '/routes' do |params, request, response| response.content_type = 'text/plain' @_[:routes].keys.map{|e| e.join("\n")}.join("\n\n") end end.start __END__ @@ template