yeager

Simple router and http server implementation router yeager
0.1.1 released
gokmen/yeager
15
Gokmen Goksel

Archived shard

This shard has been archived . It is no longer maintained or has been discontinued for other reasons.

Yeager

Simple router implementation for Crystal, named after "Router Man" - William Yeager. It supports basic router requirements with speed but not battle-tested.

Build Status

Installation

Add this to your application's shard.yml:

dependencies:
  yeager:
    github: gokmen/yeager

Usage

require "yeager"

# Create router instance
router = Yeager::Router.new

# Define your routes
router.add "/foo"
router.add "/foo/:hello"

# Run a route on router which will return nil or an
# Hash(Symbol | String => String) if there is a match
router.run "/foo"       # -> {:path => "/foo"}
router.run "/foo/world" # -> {"hello" => "world", :path => "/foo/:hello"}
router.run "/bar"       # -> nil

You can checkout tests for more examples and documentation can be accessed from here.

Todo

  • Add optional argument support like /foo/:bar?
  • Add glob support like /foo/*

Contributing

  1. Fork it ( https://github.com/gokmen/yeager/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

yeager:
  github: gokmen/yeager
  version: ~> 0.1.1
License MIT
Crystal 0.23.1

Authors

Dependencies 0

Development Dependencies 0

Dependents 0

Last synced .
search fire star recently