Skip to content

Latest commit

 

History

History
49 lines (29 loc) · 1.35 KB

README.md

File metadata and controls

49 lines (29 loc) · 1.35 KB

HammerTestbed

A demo app for the Hammer rate-limiter.

To start your Phoenix server:

  • Install dependencies with mix deps.get
  • Install Node.js dependencies with cd assets && npm install
  • Start Phoenix endpoint with mix phx.server

Now you can visit localhost:4000 from your browser.

Ready to run in production? Please check our deployment guides.

Usage

Start the server, then visit /timestamp, to get the current time. This request will be denied if the rate-limit is exceeded (5 requests in 60 seconds).

Hit /timestamp/rl to inspect the rate-limiter status.

Example:

curl http://localhost:4000/timestamp
# => {"timestamp":"2017-07-30 11:56:21.502347Z"}

See config/config.exs to see how Hammer and the backend are configured.

See lib/hammer_testbed/web/controllers/page_controller for an example of how to use the Hammer rate-limiter.

Rate Limiter Demo

Testing

Run ./bin/test.sh, observe the output.

Learn more