We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c65eeb5 commit 1eb7ea4Copy full SHA for 1eb7ea4
src/api/routes/protected.ts
@@ -1,11 +1,11 @@
1
import { FastifyPluginAsync } from "fastify";
2
-import fastifyCaching from "@fastify/caching";
+import rateLimiter from "api/plugins/rateLimiter.js";
3
4
const protectedRoute: FastifyPluginAsync = async (fastify, _options) => {
5
- fastify.register(fastifyCaching, {
6
- privacy: fastifyCaching.privacy.PRIVATE,
7
- serverExpiresIn: 0,
8
- expiresIn: 60 * 60 * 2,
+ await fastify.register(rateLimiter, {
+ limit: 15,
+ duration: 30,
+ rateLimitIdentifier: "protected",
9
});
10
fastify.get("/", async (request, reply) => {
11
const roles = await fastify.authorize(request, reply, []);
0 commit comments