diff options
author | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-07-26 21:21:03 +0530 |
---|---|---|
committer | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-07-26 21:21:03 +0530 |
commit | 55aed6d7c2df0daedbdabea0d1727acb1815ce2b (patch) | |
tree | 42dabdc4f68bd01867cd84c4a9beaa6a14ffb9c2 /backend | |
parent | 4833cc911b004b3da476863ddf27e09d93dd89c0 (diff) | |
download | admin-panel-55aed6d7c2df0daedbdabea0d1727acb1815ce2b.tar.gz admin-panel-55aed6d7c2df0daedbdabea0d1727acb1815ce2b.tar.bz2 admin-panel-55aed6d7c2df0daedbdabea0d1727acb1815ce2b.zip |
added upload feature
Diffstat (limited to 'backend')
-rw-r--r-- | backend/index.js | 12 |
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}`); |