feat: disable rate limiting (for now)
This commit is contained in:
parent
d5bf4217a8
commit
f732b79618
1 changed files with 20 additions and 20 deletions
40
server.mjs
40
server.mjs
|
@ -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 })
|
||||
|
|
Loading…
Reference in a new issue