Popularity
2.0
Declining
Activity
0.0
Stable
5
1
0

Programming language: Crystal
License: MIT License
Tags: HTTP    

router-simple.cr alternatives and similar shards

Based on the "HTTP" category.
Alternatively, view router-simple.cr alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of router-simple.cr or a related project?

Add another 'HTTP' Shard

README

router-simple

simple path router inspired by Router::Simple.

Installation

Add it to Projectfile

deps do
  github "karupanerura/router-simple.cr"
end

Usage

require "router-simple"

dispatcher = Router::Simple::Dispatcher(Hash(Symbol, String)).new()
dispatcher.add("/", {
  :controller => "Root",
  :action     => "index",
})
dispatcher.add("/users/:user_id", {
  :controller => "Users",
  :action     => "fetch_by_id",
})

dispatcher.match("/") {|result|
  p result.route.meta[:controller] # => "Root"
}

dispatcher.match("/users/1") {|result|
  p result.route.meta[:controller] # => "Users"
  p result.match["user_id"]        # => "1"
}

Development

TODO: Write instructions for development

Contributing

  1. Fork it ( https://github.com/karupanerura/router-simple.cr/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors