Skip to content

ThinhVu/hyper-express-rate-limit

Repository files navigation

hyper-express-rate-limit

Basic rate-limiting middleware for Hyper-express. Use to limit repeated requests to public APIs and/or endpoints such as password reset.

Usage

import { rateLimit } from 'hyper-express-rate-limit'

const limiter = rateLimit({
	windowMs: 15 * 60 * 1000, // 15 minutes
	limit: 100, // Limit each IP to 100 requests per `window` (here, per 15 minutes).
	standardHeaders: 'draft-7', // draft-6: `RateLimit-*` headers; draft-7: combined `RateLimit` header
	legacyHeaders: false, // Disable the `X-RateLimit-*` headers.
	// store: ... , // Use an external store for consistency across multiple server instances.
})

// Apply the rate limiting middleware to all requests.
app.use(limiter)

Issues and Contributing

If you encounter a bug or want to see something added/changed, please go ahead and open an issue! If you need help with something, feel free to start a discussion!

Credit

This repository is clone 99.99% from express-rate-limit

Thanks to Nathan Friedly, Vedant K

License

MIT © ThinhVu

About

Rate limit middleware for hyper-express

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published