nestjs-rate-limiter
Advanced tools
Comparing version 2.7.4 to 3.0.0
export * from './rate-limiter.decorator'; | ||
export * from './rate-limiter.interceptor'; | ||
export * from './rate-limiter.interface'; | ||
export * from './rate-limiter.module'; | ||
export * from './rate-limiter.guard'; |
@@ -14,4 +14,4 @@ "use strict"; | ||
__exportStar(require("./rate-limiter.decorator"), exports); | ||
__exportStar(require("./rate-limiter.interceptor"), exports); | ||
__exportStar(require("./rate-limiter.interface"), exports); | ||
__exportStar(require("./rate-limiter.module"), exports); | ||
__exportStar(require("./rate-limiter.guard"), exports); |
{ | ||
"name": "nestjs-rate-limiter", | ||
"version": "2.7.4", | ||
"description": "Highly configurable rate limiter library", | ||
"version": "3.0.0", | ||
"description": "Highly configurable and extensible rate limiter library", | ||
"repository": { | ||
@@ -17,6 +17,6 @@ "type": "git", | ||
"main": "dist/index.js", | ||
"author": "Ryan Dowling <ryan@ryandowling.me>", | ||
"author": "Onur Ozkan <contact@onurozkan.dev>", | ||
"contributors": [ | ||
"Ryan Dowling <ryan@ryandowling.me>", | ||
"Onur Ozkan <onurozkan.dev@outlook.com>" | ||
"Onur Ozkan <onurozkan.dev@outlook.com>", | ||
"Ryan Dowling <ryan@ryandowling.me>" | ||
], | ||
@@ -52,2 +52,2 @@ "license": "MIT", | ||
} | ||
} | ||
} |
@@ -8,6 +8,7 @@ <p align="center"> | ||
<p align="center"> | ||
<a href="https://www.codefactor.io/repository/github/ozkanonur/nestjs-rate-limiter"><img src="https://www.codefactor.io/repository/github/ozkanonur/nestjs-rate-limiter/badge?style=flat-square&sanitize=true" alt="Code Quality" /></a> | ||
<a href="https://www.npmjs.com/package/nestjs-rate-limiter"><img src="https://img.shields.io/npm/v/nestjs-rate-limiter.svg?style=flat-square&sanitize=true" alt="NPM Version" /></a> | ||
<a href="https://www.npmjs.com/package/nestjs-rate-limiter"><img src="https://img.shields.io/npm/dm/nestjs-rate-limiter.svg?style=flat-square&sanitize=true" alt="NPM Downloads" /></a> | ||
<a href="#"><img src="https://img.shields.io/npm/l/nestjs-rate-limiter.svg?colorB=black&label=LICENSE&style=flat-square&sanitize=true" alt="License"/></a> | ||
<a href="https://www.codefactor.io/repository/github/ozkanonur/nestjs-rate-limiter"><img src="https://www.codefactor.io/repository/github/ozkanonur/nestjs-rate-limiter/badge?sanitize=true" alt="Code Quality" /></a> | ||
<a href="https://www.npmjs.com/package/nestjs-rate-limiter"><img src="https://img.shields.io/npm/v/nestjs-rate-limiter.svg?sanitize=true" alt="NPM Version" /></a> | ||
<a href="https://www.npmjs.com/package/nestjs-rate-limiter"><img src="https://img.shields.io/npm/dm/nestjs-rate-limiter.svg?sanitize=true" alt="NPM Downloads" /></a> | ||
<a href="#"><img src="https://img.shields.io/npm/l/nestjs-rate-limiter.svg?colorB=black&label=LICENSE&sanitize=true" alt="License"/></a> | ||
<a href="#"><img src="https://github.com/ozkanonur/nestjs-rate-limiter/actions/workflows/test.yml/badge.svg?branch=master" alt="Test"/></a> | ||
@@ -21,3 +22,3 @@ </p> | ||
- [Include Module](https://github.com/ozkanonur/nestjs-rate-limiter#include-module) | ||
- [Using Interceptor](https://github.com/ozkanonur/nestjs-rate-limiter#using-interceptor) | ||
- [Using Guard](https://github.com/ozkanonur/nestjs-rate-limiter#using-guard) | ||
- [With Decorator](https://github.com/ozkanonur/nestjs-rate-limiter#with-decorator) | ||
@@ -55,3 +56,2 @@ - [With All Options](https://github.com/ozkanonur/nestjs-rate-limiter#with-all-options) | ||
- [TODO List](https://github.com/ozkanonur/nestjs-rate-limiter#todo) | ||
- [Examples](https://github.com/ozkanonur/nestjs-rate-limiter/examples/README.md) | ||
@@ -89,3 +89,3 @@ # Description | ||
```ts | ||
import { RateLimiterModule } from 'nestjs-rate-limiter'; | ||
import { RateLimiterModule } from 'nestjs-rate-limiter' | ||
@@ -98,5 +98,5 @@ @Module({ | ||
### Using Interceptor | ||
### Using Guard | ||
Now you need to register the interceptor. You can do this only on some routes: | ||
Now you need to register the guard. You can do this only on some routes: | ||
@@ -106,12 +106,12 @@ > app.controller.ts | ||
```ts | ||
import { RateLimiterInterceptor } from 'nestjs-rate-limiter'; | ||
import { RateLimiterGuard } from 'nestjs-rate-limiter' | ||
@UseInterceptors(RateLimiterInterceptor) | ||
@UseGuards(RateLimiterGuard) | ||
@Get('/login') | ||
public async login() { | ||
console.log('hello'); | ||
console.log('hello') | ||
} | ||
``` | ||
Or you can choose to register the interceptor globally: | ||
Or you can choose to register the guard globally: | ||
@@ -121,4 +121,4 @@ > app.module.ts | ||
```ts | ||
import { APP_INTERCEPTOR } from '@nestjs/core'; | ||
import { RateLimiterModule, RateLimiterInterceptor } from 'nestjs-rate-limiter'; | ||
import { APP_GUARD } from '@nestjs/core' | ||
import { RateLimiterModule, RateLimiterGuard } from 'nestjs-rate-limiter' | ||
@@ -129,4 +129,4 @@ @Module({ | ||
{ | ||
provide: APP_INTERCEPTOR, | ||
useClass: RateLimiterInterceptor, | ||
provide: APP_GUARD, | ||
useClass: RateLimiterGuard, | ||
}, | ||
@@ -146,3 +146,3 @@ ], | ||
```ts | ||
import { RateLimit } from 'nestjs-rate-limiter'; | ||
import { RateLimit } from 'nestjs-rate-limiter' | ||
@@ -152,3 +152,3 @@ @RateLimit({ keyPrefix: 'sign-up', points: 1, duration: 60, errorMessage: 'Accounts cannot be created more than once in per minute' }) | ||
public async signUp() { | ||
console.log('hello'); | ||
console.log('hello') | ||
} | ||
@@ -160,3 +160,3 @@ ``` | ||
```ts | ||
import { RateLimit } from 'nestjs-rate-limiter'; | ||
import { RateLimit } from 'nestjs-rate-limiter' | ||
@@ -171,3 +171,3 @@ @RateLimit({ | ||
public async example() { | ||
console.log('hello'); | ||
console.log('hello') | ||
} | ||
@@ -216,4 +216,4 @@ ``` | ||
{ | ||
provide: APP_INTERCEPTOR, | ||
useClass: RateLimiterInterceptor, | ||
provide: APP_GUARD, | ||
useClass: RateLimiterGuard, | ||
}, | ||
@@ -502,2 +502,1 @@ ], | ||
- [ ] Support Rpc | ||
- [ ] Github Actions |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57258
26
694
489