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 })
|
const app = Fastify({ logger: true })
|
||||||
|
|
||||||
await app
|
await app
|
||||||
.register(import('@fastify/rate-limit'), {
|
// .register(import('@fastify/rate-limit'), {
|
||||||
global: true,
|
// global: true,
|
||||||
max: 25,
|
// max: 25,
|
||||||
timeWindow: 1000 * 60 * 5,
|
// timeWindow: 1000 * 60 * 5,
|
||||||
})
|
// })
|
||||||
.register(fastifyStatic, {
|
.register(fastifyStatic, {
|
||||||
root: fileURLToPath(new URL('./dist/client', import.meta.url)),
|
root: fileURLToPath(new URL('./dist/client', import.meta.url)),
|
||||||
})
|
})
|
||||||
|
@ -21,21 +21,21 @@ await app
|
||||||
|
|
||||||
app.use(ssrHandler)
|
app.use(ssrHandler)
|
||||||
|
|
||||||
await app.setNotFoundHandler(
|
// await app.setNotFoundHandler(
|
||||||
{
|
// {
|
||||||
preHandler: app.rateLimit(),
|
// preHandler: app.rateLimit(),
|
||||||
},
|
// },
|
||||||
function (request, reply) {
|
// function (request, reply) {
|
||||||
reply.code(404).send({ nothing: 'to see here' })
|
// reply.code(404).send({ nothing: 'to see here' })
|
||||||
}
|
// }
|
||||||
)
|
// )
|
||||||
|
|
||||||
await app.setErrorHandler(function (error, request, reply) {
|
// await app.setErrorHandler(function (error, request, reply) {
|
||||||
if (error.statusCode === 429) {
|
// if (error.statusCode === 429) {
|
||||||
reply.code(429)
|
// reply.code(429)
|
||||||
error.message = 'You hit the rate limit! Slow down please!'
|
// error.message = 'You hit the rate limit! Slow down please!'
|
||||||
}
|
// }
|
||||||
reply.send(error)
|
// reply.send(error)
|
||||||
})
|
// })
|
||||||
|
|
||||||
app.listen({ port: 4321 })
|
app.listen({ port: 4321 })
|
||||||
|
|
Loading…
Reference in a new issue