Skip to content

Commit

Permalink
Remove cache on API
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoGresse committed Jul 30, 2024
1 parent 220df84 commit bef9779
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion functions/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ fastify.register(apiKeyPlugin)
fastify.register(cors, {
origin: '*',
})

fastify.addHook('onSend', (_, reply, _2, done: () => void) => {
reply.header('Cache-Control', 'must-revalidate,no-cache,no-store')
done()
})
registerSwagger(fastify)

fastify.register(sponsorsRoutes)
Expand All @@ -56,7 +61,7 @@ fastify.register(helloRoute)
fastify.setErrorHandler(fastifyErrorHandler)

if (isNodeEnvDev) {
fastify.listen({ port: 3000 }, function (err, address) {
fastify.listen({ port: 3000 }, function (err) {
if (err) {
fastify.log.error(err)
console.error('error starting fastify server', err)
Expand Down

0 comments on commit bef9779

Please sign in to comment.