A minimal, rails'esk routing library for HTTP::Server.
Orion allows you to easily add routes, groups, and middleware in order to construct your application's routing layer.
Add this to your application's shard.yml:
dependencies:
orion:
github: obsidian/orionYou will need to require orion in your project.
require "orion"You must define a class that inherits from Orion::Router. You will define your
routes directly in this class.
class MyApplicationRouter < Orion::Router
# ...
endLets define the routers's root route. root is simply an alias for get '/', action.
All routes can either be a String pointing to a Controller action or a Proc
accepting HTTP::Server::Context as a single argument. If a String is used like controller#action, it will expand into Controller.new(context : HTTP::Server::Context).action, therefor A controller must
have an initializer that takes HTTP::Server::Context as an argument, and the
specified action must not contain arguments.
class MyApplicationRouter < Orion::Router
root to: "home#index"
endBenchmarks can be run with ./benchmark.
- Fork it ( https://github.com/[your-github-name]/orion/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
- jwaldrip Jason Waldrip - creator, maintainer