Skip to content

🎥 Make videos programmatically with React

Create location.ts

Jonny Burger8fafba4bf367
diff --git a/packages/bugs/api/location.ts b/packages/bugs/api/location.ts
new file mode 100644
index 0000000000..addcb35a25
--- /dev/null
+++ b/packages/bugs/api/location.ts
@@ -0,0 +1,18 @@
+export default async function handler(request: Request) {
+ const country = request.headers.get('x-vercel-ip-country');
+ const city = request.headers.get('x-vercel-ip-city');
+
+ return new Response(JSON.stringify({country, city}), {
+ status: 200,
+ headers: {
+ 'access-control-allow-origin': '*',
+ 'access-control-allow-methods': 'GET',
+ 'access-control-allow-headers': 'Content-Type',
+ 'content-type': 'application/json',
+ },
+ });
+}
+
+export const config = {
+ runtime: 'edge',
+};