Skip to content

Instantly share code, notes, and snippets.

@kurtisdunn
Created May 27, 2015 16:40
Show Gist options
  • Save kurtisdunn/f86d6bc9f6d0b6066a1f to your computer and use it in GitHub Desktop.
Save kurtisdunn/f86d6bc9f6d0b6066a1f to your computer and use it in GitHub Desktop.
Knex.js paginated query string.
app.get('/api/:id', function(req, res) {
var query = req.params.id.toLowerCase();
knex.select('*').from('table').where('name', 'ilike', '%'+query+'%').limit(5).offset(30).orderBy('id', 'desc')
.then(function(rows){
res.send(rows);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment