lucky_router

The router for the Lucky framework, can be used outside Lucky
0.6.0 Latest release released
luckyframework/router
23 8 2
Lucky

LuckyRouter

API Documentation Website

A library for routing HTTP request with Crystal

Installation

Add this to your application's shard.yml:

dependencies:
  lucky_router:
    github: luckyframework/lucky_router

Usage

require "lucky_router"

router = LuckyRouter::Matcher(Symbol).new

router.add("get", "/users", :index)
router.add("delete", "/users/:id", :delete)

router.match("get", "/users").payload # :index
router.match("get", "/users").params # {} of String => String
router.match("delete", "/users/1").payload # :delete
router.match("delete", "/users/1").params # {"id" => "1"}
router.match("get", "/missing_route").payload # nil

Contributing

  1. Fork it ( https://github.com/luckyframework/lucky_router/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Make your changes
  4. Run ./bin/test to run the specs, build shards, and check formatting
  5. Commit your changes (git commit -am 'Add some feature')
  6. Push to the branch (git push origin my-new-feature)
  7. Create a new Pull Request

Contributors

lucky_router:
  github: luckyframework/router
  version: ~> 0.6.0
License MIT
Crystal >= 1.10.0

Authors

Dependencies 0

Development Dependencies 1

  • ameba ~> 1.5.0
    {'github' => 'crystal-ameba/ameba', 'version' => '~> 1.5.0'}

Dependents 2

Last synced .
search fire star recently