Files
calendar/apps/web/pages/api/geolocation.ts
T
c41e5ddc2c feat: add gtm to load in us only (#16146)
* add gtm to load in us only

* fix: Tried to give typescript some help

* fix: Alternative fix

* fix: Add yarn.lock

* fix: Oops

* fix: type err

---------

Co-authored-by: Alex van Andel <me@alexvanandel.com>
Co-authored-by: Udit Takkar <udit222001@gmail.com>
2024-08-14 09:31:01 +00:00

8 lines
348 B
TypeScript

import type { NextApiRequest, NextApiResponse } from "next";
export default function handler(req: NextApiRequest, res: NextApiResponse) {
const country = req.headers["x-vercel-ip-country"] || "Unknown";
res.setHeader("Cache-Control", "public, max-age=3600, s-maxage=3600, stale-while-revalidate=86400");
res.status(200).json({ country });
}