Skip to content

Commit

Permalink
product_search finding store by id added
Browse files Browse the repository at this point in the history
  • Loading branch information
tareq89 committed Oct 21, 2016
1 parent e1e3264 commit 51f1e98
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,20 @@ router.get('/store-search', function (req, res) {
})
})

router.get('/store', function (req, res) {
var ObjectId = require('mongodb').ObjectID;
var id = new ObjectId(req.query.storeid);
console.log(req.query.storeid)
MongoClient.connect(productDbUrl, function (err, db) {
db.collection('stores').findOne({_id: id}, function (err, doc) {
console.log(doc);
db.close();
res.json({store: doc})
});

})
})

app.use('/api', router);

app.listen(port);
Expand Down

0 comments on commit 51f1e98

Please sign in to comment.