Skip to content

Commit

Permalink
Update Servant example in README
Browse files Browse the repository at this point in the history
  • Loading branch information
mbg committed Mar 30, 2022
1 parent ca911cf commit 4fca1af
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,16 @@ middleware conn = rateLimiting strategy{ strategyOnRequest = customHandler }
The `Servant.RateLimit` module exports types for describing rate-limiting strategies and policies at the type-level. Consider the following API type specification:

```haskell
import Data.Time.TypeLevel

import Servant
import Servant.RateLimit

type TestAPI
= RateLimit (FixedWindow 2 50) (IPAddressPolicy "fixed:") :>
= RateLimit (FixedWindow ('Second 2) 50) (IPAddressPolicy "fixed:") :>
"fixed-window" :>
Get '[JSON] String
:<|> RateLimit (SlidingWindow 2 50) (IPAddressPolicy "sliding:") :>
:<|> RateLimit (SlidingWindow ('Second 2) 50) (IPAddressPolicy "sliding:") :>
"sliding-window" :>
Get '[JSON] String
:<|> "unrestricted" :>
Expand Down

0 comments on commit 4fca1af

Please sign in to comment.