Spaces:
Sleeping

anycoder-7491f760 / pages /api /stores.js
ryeisi's picture
Upload pages/api/stores.js with huggingface_hub
d8987dd verified
Raw History Blame Contribute Delete
1.01 kB
export default function handler(req, res) {
if (req.method === 'GET') {
// In a real app, you would fetch from a database
const stores = [
{
id: 1,
name: 'Urban Threads',
city: 'New York',
category: 'Fashion & Clothing',
description: 'Trendy urban clothing for men and women with a focus on sustainable materials.',
logo: 'https://cdn.shopify.com/s/files/1/0533/2089/files/placeholder-logo-1.png',
url: 'https://urban-threads.myshopify.com'
},
// ... other stores
];
res.status(200).json(stores);
} else if (req.method === 'POST') {
// Handle store submission
const newStore = req.body;
// In a real app, you would save to a database
console.log('New store submission:', newStore);
res.status(201).json({ message: 'Store submitted successfully', store: newStore });
} else {
res.setHeader('Allow', ['GET', 'POST']);
res.status(405).end(`Method ${req.method} Not Allowed`);
}
}