Skip to content

Commit

Permalink
chore: Updated the README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Adil committed Sep 21, 2024
1 parent 41f3b75 commit ea03600
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,28 @@ export const config: MiddlewaresConfig = {
}
```

<h3> Default Middleware </h3>

<p>We also provide a out of the box middleware that you can use immediately without needing to create your own. This middleware is exposed and can be used as follows:</p>

```ts
import { MiddlewaresConfig } from '@medusajs/medusa'
import { rateLimitRoutes } from '@perseidesjs/medusa-plugin-rate-limit'

export const config: MiddlewaresConfig = {
routes: [
{
// This will limit the number of requests to 5 per 60 seconds on the auth route using the default middleware
matcher: '/store/auth',
middlewares: [rateLimitRoutes],
},
],
}
```


<h2> More information </h2>
<p> You can find the <code>RateLimitService</code> class in the <a href="https://github.com/perseidesjs/medusa-plugin-rate-limit/blob/main/src/services/rate-limit.ts">src/services/rate-limit.ts</a> file.</p>

<h2>License</h2>
<p> This project is licensed under the MIT License - see the <a href="./LICENSE.md">LICENSE</a> file for details</p>
<p> This project is licensed under the MIT License - see the <a href="./LICENSE.md">LICENSE</a> file for details</p>

0 comments on commit ea03600

Please sign in to comment.