response caching

This commit is contained in:
Matthias Kretschmann 2024-04-05 00:15:38 +01:00
parent d1adc49455
commit 0c3eecd681
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 5 additions and 3 deletions

View File

@ -20,7 +20,7 @@ export async function GET(request: NextRequest) {
return Response.json(null, { status: 400 }) return Response.json(null, { status: 400 })
} }
const url = `${apiUrl}/prices/?tokens=${tokens}` const url = `${apiUrl}/prices?tokens=${tokens}`
let data let data
let status let status
@ -39,7 +39,8 @@ export async function GET(request: NextRequest) {
return new Response(JSON.stringify(data), { return new Response(JSON.stringify(data), {
status, status,
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json',
'Cache-Control': 'public, s-max-age=60'
} }
}) })
} }

View File

@ -32,7 +32,8 @@ export async function GET(request: NextRequest) {
return new Response(JSON.stringify(data), { return new Response(JSON.stringify(data), {
status, status,
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json',
'Cache-Control': 'public, s-maxage=10'
} }
}) })
} }