Project

app-routes

0.0
No commit activity in last 3 years
No release in over 3 years
app-routes
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Introducing app-routes gem 0.1.17

require 'app-routes'

class Fun
  include AppRoutes

  def initialize()
    super()
    params = {}
    routes(@params)
  end

  def routes(params) 

    get '/sugar' do 
      'ffff'
    end

    get '/sour' do 
      'gggg'
    end

    get '/hello/:name' do
      'zzzz ... hello ' + params[:name]
    end

    get %r{/hello2/([\w]+)} do
      'ready ' + params[:captures].first
    end

    get '/addresses' do
      'inside addresses 2'
    end

    post '/addresses' do
      'inside addresses'
    end

  end


end

fun = Fun.new

fun.run_route '/sour'
#=>  "gggg"

fun.run_route '/hello/James'
#=> "zzzz ... hello James"

fun.add_route '/hello3/:name' do |name|
  'welcome ' + name
end

fun.run_route '/hello3/James'
#=> "welcome James"

fun.run_route '/addresses', 'POST'
#=> "inside addresses" 

fun.run_route '/addresses'
#=> "inside addresses 2"

Resources

gem approutes route routes