mirror of
https://github.com/Xevion/bus-reminder.git
synced 2025-12-10 20:06:41 -06:00
Edge Cache time as environment variable
This commit is contained in:
@@ -20,10 +20,11 @@ export default async function handler(
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const diff = await getDistance();
|
||||
|
||||
// auth passed
|
||||
res.setHeader('Cache-Control', 'max-age=0, s-maxage=60, stale-while-revalidate');
|
||||
res.setHeader('Cache-Control', `max-age=0, s-maxage=${env.EDGE_CACHE_TIME_SECONDS}, stale-while-revalidate`);
|
||||
// @ts-ignore
|
||||
res.status(200).json({ diff, inRange: diff < env.MAX_DISTANCE });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user