From 0c3eecd68123b97c0fec810642232f84948cc7bd Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 5 Apr 2024 00:15:38 +0100 Subject: [PATCH] response caching --- app/api/prices/route.ts | 5 +++-- app/api/quote/route.ts | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/api/prices/route.ts b/app/api/prices/route.ts index 0f5c59e..f435f52 100644 --- a/app/api/prices/route.ts +++ b/app/api/prices/route.ts @@ -20,7 +20,7 @@ export async function GET(request: NextRequest) { return Response.json(null, { status: 400 }) } - const url = `${apiUrl}/prices/?tokens=${tokens}` + const url = `${apiUrl}/prices?tokens=${tokens}` let data let status @@ -39,7 +39,8 @@ export async function GET(request: NextRequest) { return new Response(JSON.stringify(data), { status, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'Cache-Control': 'public, s-max-age=60' } }) } diff --git a/app/api/quote/route.ts b/app/api/quote/route.ts index 3bb5749..7eb93d5 100644 --- a/app/api/quote/route.ts +++ b/app/api/quote/route.ts @@ -32,7 +32,8 @@ export async function GET(request: NextRequest) { return new Response(JSON.stringify(data), { status, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'Cache-Control': 'public, s-maxage=10' } }) }