coalesceFindRequests

This commit is contained in:
Matthew Dillon 2015-03-19 13:39:04 -08:00
parent 37becad20a
commit 6e7e04f225
3 changed files with 20 additions and 3 deletions

View file

@ -3,5 +3,6 @@ import config from '../config/environment';
export default DS.RESTAdapter.reopen({ export default DS.RESTAdapter.reopen({
namespace: 'api/hymenobacter', namespace: 'api/hymenobacter',
host: config.apiURL host: config.apiURL,
coalesceFindRequests: true,
}); });

View file

@ -146,8 +146,16 @@ module.exports = function(app) {
] ]
measurementsRouter.get('/', function(req, res) { measurementsRouter.get('/', function(req, res) {
var measurements;
if (req.query.ids) {
measurements = MEASUREMENTS.filter(function(m) {
return req.query.ids.indexOf(m.id.toString()) > -1;
});
} else {
measurements = MEASUREMENTS;
}
res.send({ res.send({
'measurements': MEASUREMENTS 'measurements': measurements
}); });
}); });

View file

@ -66,8 +66,16 @@ module.exports = function(app) {
]; ];
strainsRouter.get('/', function(req, res) { strainsRouter.get('/', function(req, res) {
var strains;
if (req.query.ids) {
strains = STRAINS.filter(function(s) {
return req.query.ids.indexOf(s.id.toString()) > -1;
});
} else {
strains = STRAINS;
}
res.send({ res.send({
'strains': STRAINS 'strains': strains
}); });
}); });