Spaces:
Build error
Build error
Upload pages/api/contact.js with huggingface_hub
Browse files- pages/api/contact.js +19 -0
pages/api/contact.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export default function handler(req, res) {
|
| 2 |
+
if (req.method !== 'POST') {
|
| 3 |
+
return res.status(405).json({ message: 'Method not allowed' });
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
try {
|
| 7 |
+
const { name, email, message } = req.body;
|
| 8 |
+
|
| 9 |
+
// Here you would typically send the email or save to database
|
| 10 |
+
// For this example, we'll just return a success response
|
| 11 |
+
|
| 12 |
+
console.log('Contact form submission:', { name, email, message });
|
| 13 |
+
|
| 14 |
+
return res.status(200).json({ success: true });
|
| 15 |
+
} catch (error) {
|
| 16 |
+
console.error('Contact form error:', error);
|
| 17 |
+
return res.status(500).json({ message: 'Internal server error' });
|
| 18 |
+
}
|
| 19 |
+
}
|