feat: disable rate limiting (for now)

This commit is contained in:
Ayo Ayco 2025-08-27 09:08:08 +02:00
parent d5bf4217a8
commit f732b79618

View file

@ -9,11 +9,11 @@ import { handler as ssrHandler } from './dist/server/entry.mjs'
const app = Fastify({ logger: true })
await app
.register(import('@fastify/rate-limit'), {
global: true,
max: 25,
timeWindow: 1000 * 60 * 5,
})
// .register(import('@fastify/rate-limit'), {
// global: true,
// max: 25,
// timeWindow: 1000 * 60 * 5,
// })
.register(fastifyStatic, {
root: fileURLToPath(new URL('./dist/client', import.meta.url)),
})
@ -21,21 +21,21 @@ await app
app.use(ssrHandler)
await app.setNotFoundHandler(
{
preHandler: app.rateLimit(),
},
function (request, reply) {
reply.code(404).send({ nothing: 'to see here' })
}
)
// await app.setNotFoundHandler(
// {
// preHandler: app.rateLimit(),
// },
// function (request, reply) {
// reply.code(404).send({ nothing: 'to see here' })
// }
// )
await app.setErrorHandler(function (error, request, reply) {
if (error.statusCode === 429) {
reply.code(429)
error.message = 'You hit the rate limit! Slow down please!'
}
reply.send(error)
})
// await app.setErrorHandler(function (error, request, reply) {
// if (error.statusCode === 429) {
// reply.code(429)
// error.message = 'You hit the rate limit! Slow down please!'
// }
// reply.send(error)
// })
app.listen({ port: 4321 })