// src/index.js import { renderHtml } from './renderHtml.js'; addEventListener('fetch', event => { event.respondWith(handleRequest(event.request)); }); /** * Handles incoming HTTP requests. * @param {Request} request * @returns {Promise} */ async function handleRequest(request) { const { pathname } = new URL(request.url); if (pathname === '/') { const html = await renderHtml(); return new Response(html, { headers: { 'Content-Type': 'text/html;charset=UTF-8' } }); } else if (pathname === '/generate') { return new Response(JSON.stringify(getSlides()), { headers: { 'Content-Type': 'application/json' }, }); } else { return new Response('Not Found', { status: 404 }); } } /** * Returns predefined slide data. * @returns {Object} */ function getSlides() { return { slides: [ { heading: "Welcome to Melinda AI", content: "Create stunning video presentations effortlessly.", imageUrl: "https://source.unsplash.com/1600x900/?presentation", videoUrl: "https://www.youtube.com/embed/dQw4w9WgXcQ", animation: "fadeIn", codeSnippet: 'function greet(name) {\n return `Hello, ${name}!`;\n}', speakerNotes: "Introduce Melinda AI and its capabilities.", theme: "default", languages: ["en"], }, { heading: "Smooth Transitions", content: "Experience seamless transitions with cinematic effects.", imageUrl: "https://source.unsplash.com/1600x900/?animation", animation: "slideInUp", codeSnippet: 'gsap.from(".slide-heading", { duration: 2, y: -50, opacity: 0 });', speakerNotes: "Demonstrate animation improvements.", theme: "dark", languages: ["en"], }, { heading: "Interactive Elements", content: "Engage your audience with interactive buttons and polls.", imageUrl: "https://source.unsplash.com/1600x900/?interactive", animation: "zoomIn", codeSnippet: '', speakerNotes: "Explain benefits of interactivity.", theme: "light", languages: ["en"], }, { heading: "Multimedia Integration", content: "Incorporate videos and images seamlessly into your presentations.", imageUrl: "https://source.unsplash.com/1600x900/?multimedia", videoUrl: "https://www.youtube.com/embed/5NV6Rdv1a3I", animation: "fadeIn", codeSnippet: '
\n \n
', speakerNotes: "Highlight multimedia importance.", theme: "default", languages: ["en"], }, { heading: "Accessibility & Themes", content: "Ensure your presentations are accessible with customizable themes.", imageUrl: "https://source.unsplash.com/1600x900/?accessibility", animation: "slideInUp", codeSnippet: 'body.theme-dark {\n background-color: #1a202c;\n color: #a0aec0;\n}', speakerNotes: "Discuss accessibility features.", theme: "dark", languages: ["en"], }, // Add more slides here to cover all desired features (up to 30) ], }; }