Created
May 27, 2015 16:40
-
-
Save kurtisdunn/f86d6bc9f6d0b6066a1f to your computer and use it in GitHub Desktop.
Knex.js paginated query string.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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