• Stars
    star
    5
  • Rank 2,777,307 (Top 57 %)
  • Language
    Crystal
  • License
    MIT License
  • Created almost 9 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

simple path router inspired by Router::Simple.

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

More Repositories

1

Aniki

The ORM as our great brother.
Perl
34
star
2

dotfiles

oh my dotfiles
Perl
15
star
3

TOML-Parser

simple toml parser
Perl
15
star
4

gostress

HTTP/HTTPS stress test framework.
Go
15
star
5

timetable-editor

Web Timetable Editor (WIP: debugging/developing)
Vue
10
star
6

gae-dispatcher-emulator

Unofficial Google App Engine Dispatcher Emulator
Go
10
star
7

isucon5-benchmarker

Perl
9
star
8

MySQL-Dump-Parser-XS

mysqldump SQL parser
C
9
star
9

Time-Strptime

parse date and time string as fast.
Perl
8
star
10

p5-App-wwwbench

[OBSOLUTED] simple web access benchmark tool.
Perl
7
star
11

gcsproxy

HTTP Proxy for Goolge Cloud Storage
Go
7
star
12

c-git-git

git git git git git git git git status
CMake
7
star
13

go-httpagent

HTTP Agent for go programming language. Provides hooks, timeout, and default header for http.Client and any other similar interface.
Go
6
star
14

Workman

light weight job-queue worker framework
Perl
5
star
15

plenv.el

A plenv wrapper for Emacs
Emacs Lisp
5
star
16

p5-AnyEvent-ForkManager

A simple parallel processing fork manager with AnyEvent
Perl
5
star
17

google-cloud-workflow-emulator

Unofficial Google Cloud Workflow emulator
Go
5
star
18

DateTimeX-Moment

EXPERIMENTAL DateTime like interface for Time::Moment
Perl
5
star
19

swift-GeoHex3

C
4
star
20

c-geohex3

Geohex v3 implement in C99.
C
4
star
21

Geo-Hex-V3-XS

GeoHex implementation with XS. (c-geohex3 Perl5 binding.)
Perl
4
star
22

go-mock-http-response

Simple http client mock tool
Go
4
star
23

p5-Atelier

Light weight web application framework have Sledge like interface on PSGI.
Perl
4
star
24

mkr-check-self

Run all mackerel check scripts manually
Go
3
star
25

go-httpflow

Simple web api client framework for go programming language
Go
3
star
26

isucon6-qualifier

ISUCON6 予選
Scala
3
star
27

.emacs.d

.emacs.d
Emacs Lisp
3
star
28

p5-Cache-KyotoTycoon-Serialize

Add support serialize for Cache::KyotoTycoon.
Perl
2
star
29

WWW-Connpass

browser for connpass(R)
Perl
2
star
30

Raft

yet another web application framework
Perl
2
star
31

isucon7-pre-public

git filter-branchでいろいろお掃除したISUCON7予選リポジトリ
HTML
2
star
32

p5-any

Perl
2
star
33

go-errgroup2

This is simple fork of "golang.org/x/sync/errgroup" to stop using "golang.org/x/net/context".
Go
2
star
34

p5-Teng-Plugin-Static

easy dummy data creation support with Teng
Perl
2
star
35

p5-JSON5

The JSON5 implementation for Perl 5
Perl
2
star
36

p5-HTML-Lint-Pluggable

plugin system for HTML::Lint
Perl
2
star
37

p5-Plack-App-Directory-Xslate

Serve static files and Text::Xslate template files from document root with directory index
Perl
2
star
38

gomikuji

Omikuji written in Go lang.
Go
2
star
39

p5-AnyBot

oreore bot framework
Perl
2
star
40

XOClock

This is a special Job Queue Server to be running registered job at a specified time. 指定した時刻に指定したJobを一度だけ実行する特殊なJobQueueServer/Client。
Perl
2
star
41

p5-iq

decrement IQ for your perl applciation
Perl
2
star
42

p5-Filesys-Notify-KQueue

Wrap IO::KQueue for watching file system.
Perl
2
star
43

Memoize-Class-Constructor

The constructor return the same instance if the constructor is passed the same arguments.
Perl
1
star
44

List-Range

Range processor for integers
Perl
1
star
45

IO-Concurrent

[draft idea] Concurrent I/O framework
Perl
1
star
46

minimum-httpd

C
1
star
47

logz-elasticsearch

Go
1
star
48

isucon12-qualifier

惨敗/Perl
Java
1
star
49

isucon13

ISUCON13 本番用
Perl
1
star
50

TOML-Dumper

Perl
1
star
51

go-testing-log-writer

Go
1
star
52

Parallel-Async

run parallel task with fork to simple.
Perl
1
star
53

Getopt-DSL

Perl
1
star
54

Groonga-QueryBuilder

simple groonga's select query builder.
Perl
1
star
55

p5-Amon2-Plugin-Web-View-Xslate

create Text::Xslate object in Amon2::Plugin
Perl
1
star
56

p5-String-Secret

Perl
1
star
57

Time-Strptime-libc

C
1
star
58

Cache-Keys-DSL

Declare cache key generator by DSL
Perl
1
star
59

p5-Plack-Middleware-Forward

Perl Module of Plack::Middleware::Forward
Perl
1
star
60

DBIx-TransactionManager-Extended

extended DBIx::TransactionManager
Perl
1
star
61

Plack-App-Vhost

Simple virtual host implementation on Plack.
Perl
1
star
62

Plack-Middleware-Auth-OpenID

Perl
1
star
63

Reactift

DO *NOT* USE IT
Swift
1
star
64

Server-Engine

prefork server framework. inspired by serverengine(rubygems).
Perl
1
star
65

URI-s3

URI::s3 is an URI scheme handler for s3:// protocol.
Perl
1
star
66

go-html-digest

Make HTML DOM structure digest.
Go
1
star
67

Test-SharedObject

Data sharing in multi process.
Perl
1
star
68

SQL-Translator-Producer-DBIxSchemaDSL

DBIx::Schema::DSL specific producer for SQL::Translator
Perl
1
star
69

static-omikuji

CSS
1
star