/** * Voice Demo Session Create - OPTIONS Handler * * Handles CORS preflight OPTIONS requests for the voice demo session endpoint. * This allows browsers to make cross-origin requests from localhost:3006 to Railway. * * Path: OPTIONS /api/sessions/voice-demo */ export const config = { name: 'VoiceDemoSessionCreateOptions', type: 'api', path: '/api/sessions/voice-demo', method: 'OPTIONS', description: 'Handle CORS preflight for voice demo session creation', }; export const handler = async (_req: MotiaRequest) => { // Return CORS headers for preflight request return { status: 204, // No Content - standard for OPTIONS headers: { 'Access-Control-Allow-Origin': '*', // Allow all origins including localhost:3006 'Access-Control-Allow-Methods': 'POST, OPTIONS', 'Access-Control-Allow-Headers': 'Content-Type, Authorization', 'Access-Control-Max-Age': '86400', // Cache preflight for 24 hours }, body: null, }; };