Skip to content
generated from supranim/starter

Supranim's Limiter - A simple to use rate limiting library for HTTP apps to limit any action during a specific period of time.

License

Notifications You must be signed in to change notification settings

supranim/limiter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Supranim Rate Limiter
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.

✨ Key features

  • Framework Agnostic
  • Persistent Memory w/ Supranim Storage driver
  • Dependency-free
  • Open Source | MIT License

Install

nimble install limiter

Examples

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")

❤ Contributions

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 🥰

👑 Discover Nim language

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.

🎩 License

Limiter is an Open Source Software released under MIT license. Made by Humans from OpenPeep.
Copyright © 2022 Supranim & OpenPeep — All rights reserved.

About

Supranim's Limiter - A simple to use rate limiting library for HTTP apps to limit any action during a specific period of time.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages