const corsHeaders = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',
}
export function createHandler(tasks = originalTasks) {
return async function (req: Request) {
if (req.method !== 'POST') {
console.log(`Method not allowed: ${req.method}`);
return new Response(JSON.stringify({ error: 'Method not allowed' }), {
headers: { ...corsHeaders, 'Allow': 'POST' },
status: 405,
});
}
return new Response(JSON.stringify('hello'), {
headers: { ...corsHeaders, 'Content-Type': 'application/json' },
status: 200,
});
};
}
const corsHeaders = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',
}
export function createHandler(tasks = originalTasks) {
return async function (req: Request) {
if (req.method !== 'POST') {
console.log(`Method not allowed: ${req.method}`);
return new Response(JSON.stringify({ error: 'Method not allowed' }), {
headers: { ...corsHeaders, 'Allow': 'POST' },
status: 405,
});
}
return new Response(JSON.stringify('hello'), {
headers: { ...corsHeaders, 'Content-Type': 'application/json' },
status: 200,
});
};
}