A simple to use rate limiting library for HTTP apps. Built-in memory cache,
provides an easy way to limit any action during a specific period of time.
- Framework Agnostic
- Persistent Memory w/ Supranim Storage driver
- Dependency-free
- Open Source |
MIT
License
nimble install limiter
Using Limiter from your Supranim application
import supranim, limiter
proc sendConfirmationLink*(req: Request, res: Response) =
## Example of a ``POST`` procedure to handle confirmation links.
let getUserId = RateLimiter.getId("send.message", 1234)
RateLimiter.attempt(getUserId, maxAttempts = 3) do(remaining: Duration):
res.json("Too many attempts. Try again in " & $(remaining.inSeconds) & " seconds", Http429)
# ...
# handle confirmation links...
# ...
res.json("Confirmation link sent. Check your e-mail")
If you like this project you can contribute to this project by opening new issues, fixing bugs, contribute with code, ideas and you can even donate via PayPal address 🥰
What's Nim? Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Find out more about Nim language
Why Nim? Performance, fast compilation and C-like freedom. We want to keep code clean, readable, concise, and close to our intention. Also a very good language to learn in 2022.
Limiter is an Open Source Software released under MIT
license. Made by Humans from OpenPeep.
Copyright © 2022 Supranim & OpenPeep — All rights reserved.