Spaces:
Sleeping
Sleeping
Upload pages/api/stores.js with huggingface_hub
Browse files- pages/api/stores.js +28 -0
pages/api/stores.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export default function handler(req, res) {
|
| 2 |
+
if (req.method === 'GET') {
|
| 3 |
+
// In a real app, you would fetch from a database
|
| 4 |
+
const stores = [
|
| 5 |
+
{
|
| 6 |
+
id: 1,
|
| 7 |
+
name: 'Urban Threads',
|
| 8 |
+
city: 'New York',
|
| 9 |
+
category: 'Fashion & Clothing',
|
| 10 |
+
description: 'Trendy urban clothing for men and women with a focus on sustainable materials.',
|
| 11 |
+
logo: 'https://cdn.shopify.com/s/files/1/0533/2089/files/placeholder-logo-1.png',
|
| 12 |
+
url: 'https://urban-threads.myshopify.com'
|
| 13 |
+
},
|
| 14 |
+
// ... other stores
|
| 15 |
+
];
|
| 16 |
+
|
| 17 |
+
res.status(200).json(stores);
|
| 18 |
+
} else if (req.method === 'POST') {
|
| 19 |
+
// Handle store submission
|
| 20 |
+
const newStore = req.body;
|
| 21 |
+
// In a real app, you would save to a database
|
| 22 |
+
console.log('New store submission:', newStore);
|
| 23 |
+
res.status(201).json({ message: 'Store submitted successfully', store: newStore });
|
| 24 |
+
} else {
|
| 25 |
+
res.setHeader('Allow', ['GET', 'POST']);
|
| 26 |
+
res.status(405).end(`Method ${req.method} Not Allowed`);
|
| 27 |
+
}
|
| 28 |
+
}
|