Spaces:
Build error
Build error
| export default function handler(req, res) { | |
| if (req.method === 'POST') { | |
| const { name, email, message } = req.body; | |
| // Basic validation | |
| if (!name || !email || !message) { | |
| return res.status(400).json({ error: 'Missing required fields' }); | |
| } | |
| // In a real app, you would save this to a database or send an email | |
| console.log('Contact Form Submission:', { name, email, message }); | |
| // Simulate network delay | |
| setTimeout(() => { | |
| res.status(200).json({ message: 'Transmission received successfully' }); | |
| }, 1000); | |
| } else { | |
| res.setHeader('Allow', ['POST']); | |
| res.status(405).end(`Method ${req.method} Not Allowed`); | |
| } | |
| } |