mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 01:40:01 +00:00
183fe0a93c
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
19 lines
837 B
TypeScript
19 lines
837 B
TypeScript
// Returns the Mapbox public token for client-side map rendering.
|
|
// Public tokens (pk.*) are safe to expose; we fetch via edge function so
|
|
// the token can be rotated without redeploying the frontend.
|
|
|
|
const corsHeaders = {
|
|
"Access-Control-Allow-Origin": "*",
|
|
"Access-Control-Allow-Headers":
|
|
"authorization, x-client-info, apikey, content-type, x-supabase-client-platform, x-supabase-client-platform-version, x-supabase-client-runtime, x-supabase-client-runtime-version",
|
|
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
|
|
};
|
|
|
|
Deno.serve((req) => {
|
|
if (req.method === "OPTIONS") return new Response("ok", { headers: corsHeaders });
|
|
const token = Deno.env.get("MAPBOX_PUBLIC_TOKEN") || "";
|
|
return new Response(JSON.stringify({ token }), {
|
|
headers: { ...corsHeaders, "Content-Type": "application/json" },
|
|
});
|
|
});
|