bookshelf.js - Node.js API filtering -
I have a closing point: Channels /: id / albums -> Return all albums for a specific channel
What do I want to do: How can I pre-filter for the results, suppose I want only albums that want specific fields, or have returned the number of rows.
How can I get it? Express in Node.js? A sample code that I now have the rig:
New Album (). Where ('channel_id', '=', req.params.channel_id) .fetchAll () Then (function (album) {res.json ({error: incorrect, position: 200, data: album});}). Otherwise (function (mistake) {res.status (500) .json ({error: true, data: {message: err.message}})}}; Thanks,
Add them as query string parameters And then check them in your express way. For example, if your request was channel / 12345 / album max5sults = 200 , then you should read that code in the request with the query object Should be able to.
will be appetite ('channel /: id / album', function (rik, ridge) {// req.query.maxResults 200});
Comments
Post a Comment