Files
2026-06-01 20:19:26 -04:00

24 lines
725 B
TypeScript

const corsHeaders = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',
};
Deno.serve(async (req) => {
if (req.method === 'OPTIONS') {
return new Response(null, { headers: corsHeaders });
}
const apiKey = Deno.env.get('GOOGLE_MAPS_API_KEY');
if (!apiKey) {
return new Response(
JSON.stringify({ error: 'Google Maps API key not configured' }),
{ status: 500, headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
);
}
return new Response(
JSON.stringify({ key: apiKey }),
{ headers: { ...corsHeaders, 'Content-Type': 'application/json', 'Cache-Control': 'private, max-age=3600' } }
);
});