ColdSlim commited on
Commit
583626c
·
verified ·
1 Parent(s): ec92847

Upload pages/api/contact.js with huggingface_hub

Browse files
Files changed (1) hide show
  1. pages/api/contact.js +21 -0
pages/api/contact.js ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export default function handler(req, res) {
2
+ if (req.method === 'POST') {
3
+ const { name, email, message } = req.body;
4
+
5
+ // Basic validation
6
+ if (!name || !email || !message) {
7
+ return res.status(400).json({ error: 'Missing required fields' });
8
+ }
9
+
10
+ // In a real app, you would save this to a database or send an email
11
+ console.log('Contact Form Submission:', { name, email, message });
12
+
13
+ // Simulate network delay
14
+ setTimeout(() => {
15
+ res.status(200).json({ message: 'Transmission received successfully' });
16
+ }, 1000);
17
+ } else {
18
+ res.setHeader('Allow', ['POST']);
19
+ res.status(405).end(`Method ${req.method} Not Allowed`);
20
+ }
21
+ }