aboutsummaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/index.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/backend/index.js b/backend/index.js
index 5bcc507..c7ac324 100644
--- a/backend/index.js
+++ b/backend/index.js
@@ -82,6 +82,18 @@ app.post('/login', async (req, res) => {
}
});
+// Fetch ads route
+app.get('/ads', async (req, res) => {
+ try {
+ const adsSnapshot = await db.collection('ads').get();
+ const ads = adsSnapshot.docs.map(doc => ({ id: doc.id, ...doc.data() }));
+ res.json(ads);
+ } catch (error) {
+ console.error('Error fetching ads:', error);
+ res.status(500).send('Error fetching ads');
+ }
+});
+
const PORT = 5000;
app.listen(PORT, () => {
console.log(`Server running on http://localhost:${PORT}`);