mongodb-simple-rest
Version:
A simple (to use) REST API for MongoDB
21 lines (13 loc) • 360 B
JavaScript
module.exports = {
route: ':collection',
openRoute: function (req, res, params, done) {
params.logger.info('Opening collection ' + req.params.collection);
params.db.collection(req.params.collection, function (err, collection) {
if (err) {
throw err;
}
params.collection = collection;
done(params);
});
},
};