Skip to content

Commit

Permalink
disabled caching
Browse files Browse the repository at this point in the history
  • Loading branch information
rupamkairi committed Jan 13, 2025
1 parent fc67b97 commit 4065c0b
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions apps/server/src/pages/api/v1/fires/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ import type { NextApiRequest, NextApiResponse } from "next";
import { prisma } from "../../../../server/db";
import { logger } from "../../../../server/logger";



type ResponseData =
| GeoJSON.GeoJSON
| {
message?: string;
error?: object | unknown;
};

const CACHING = false;

export default async function firesBySiteHandler(
req: NextApiRequest,
res: NextApiResponse<ResponseData>
Expand Down Expand Up @@ -63,12 +67,14 @@ export default async function firesBySiteHandler(
}))
);

res.setHeader(
"Cache-Control",
"public, max-age=7200 s-maxage=3600, stale-while-revalidate=7200"
);
res.setHeader("CDN-Cache-Control", "max-age=7200");
res.setHeader("Cloudflare-CDN-Cache-Control", "max-age=7200");
if(CACHING) {
res.setHeader(
"Cache-Control",
"public, max-age=7200 s-maxage=3600, stale-while-revalidate=7200"
);
res.setHeader("CDN-Cache-Control", "max-age=7200");
res.setHeader("Cloudflare-CDN-Cache-Control", "max-age=7200");
}

res.status(200).json(fires);
} catch (error) {
Expand Down

0 comments on commit 4065c0b

Please sign in to comment.