Skip to content

Commit 1a5975f

Browse files
committed
docker integration
1 parent c4943e1 commit 1a5975f

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

auth/Online_course_blog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 2b14b1b6d83f46cc5af9748c1e8ebe4a81bb7fb7

server/database/app.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,38 @@ app.get('/fetchReviews/dealer/:id', async (req, res) => {
5959
// Express route to fetch all dealerships
6060
app.get('/fetchDealers', async (req, res) => {
6161
//Write your code here
62+
try {
63+
const documents = await Dealerships.find();
64+
res.json(documents);
65+
} catch (error) {
66+
res.status(500).json({ error: 'Error fetching documents' });
67+
}
6268
});
6369

6470
// Express route to fetch Dealers by a particular state
6571
app.get('/fetchDealers/:state', async (req, res) => {
6672
//Write your code here
73+
try{
74+
const documents = await Dealerships.find({state: req.params.state});
75+
res.json(documents);
76+
} catch (error) {
77+
res.status(500).json({ error: 'Error fetching documents' });
78+
}
6779
});
6880

6981
// Express route to fetch dealer by a particular id
7082
app.get('/fetchDealer/:id', async (req, res) => {
7183
//Write your code here
84+
try {
85+
const documents = await Dealerships.find({id: req.params.id});
86+
if (!documents) {
87+
return res.status(404).json({ error: 'Dealership not found' });
88+
}
89+
res.json(documents);
90+
} catch (error) {
91+
res.status(500).json({ error: 'Error fetching documents' });
92+
}
93+
7294
});
7395

7496
//Express route to insert review

0 commit comments

Comments
 (0)