Skip to content

Commit

Permalink
Remove cache on API (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoGresse authored Jul 30, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent e7e563b commit 03a28ed
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
@@ -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)
@@ -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)

0 comments on commit 03a28ed

Please sign in to comment.