diff options
author | franck cuny <franck@lumberjaph.net> | 2010-03-01 17:59:44 +0100 |
---|---|---|
committer | franck cuny <franck@lumberjaph.net> | 2010-03-01 17:59:44 +0100 |
commit | 557ccb547bb456b1aa74daf05bf7f580a6dd0671 (patch) | |
tree | 076a12b1eef7cade7d76379348c0c2b629551a42 | |
parent | a middleware to throttle request on an API (diff) | |
download | plack-middleware-apiratelimit-557ccb547bb456b1aa74daf05bf7f580a6dd0671.tar.gz |
update README
-rw-r--r-- | Makefile.PL | 4 | ||||
-rw-r--r-- | README | 50 |
2 files changed, 38 insertions, 16 deletions
diff --git a/Makefile.PL b/Makefile.PL index 5297eaa..d83486c 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -7,6 +7,10 @@ all_from 'lib/Plack/Middleware/APIRateLimit.pm'; tests 't/*.t'; author_tests 'xt'; +author 'Franck Cuny'; +license 'perl'; +readme_from 'lib/Plack/Middleware/APIRateLimit.pm'; + build_requires 'Test::More'; use_test_base; auto_include; diff --git a/README b/README index 722437a..5ab97aa 100644 --- a/README +++ b/README @@ -1,27 +1,45 @@ -This is Perl module Plack::Middleware::APIRateLimit. +NAME + Plack::Middleware::APIRateLimit - A Plack Middleware for API Throttling -INSTALLATION +SYNOPSIS + my $handler = builder { + enable "APIRateLimit"; + # or + enable "APIRateLimit", requests_per_hour => 2, backend => "Hash"; + # or + enable "APIRateLimit", requests_per_hour => 2, backend => ["Redis", {port => 6379, server => '127.0.0.1'}]; + sub { [ '200', [ 'Content-Type' => 'text/html' ], ['hello world'] ] }; + }; -Plack::Middleware::APIRateLimit installation is straightforward. If your CPAN shell is set up, -you should just be able to do +DESCRIPTION + Plack::Middleware::APIRateLimit is a Plack middleware for controlling + API access. - % cpan Plack::Middleware::APIRateLimit + Set a limit on how many requests per hour is allowed on your API. In the + case of a authorized request, 3 headers are added: -Download it, unpack it, then build it as per the usual: + X-RateLimit-Limit + How many requests are authorized by hours - % perl Makefile.PL - % make && make test + X-RateLimit-Remaining + How many remaining requests -Then install it: + X-RateLimit-Reset + When will the counter be reseted (in epoch) - % make install + VARIABLES + backend + Which backend to use. Currently only Hash and Redis are supported. + If no backend is specified, Hash is used by default. -DOCUMENTATION + requests_per_hour + How many requests is allowed by hour. -Plack::Middleware::APIRateLimit documentation is available as in POD. So you can do: +AUTHOR + franck cuny <franck@linkfluence.net> - % perldoc Plack::Middleware::APIRateLimit +SEE ALSO +LICENSE + This library is free software; you can redistribute it and/or modify it + under the same terms as Perl itself. -to read the documentation online with your favorite pager. - -franck cuny |