Permalink
Browse files

Fix page numbers

  • Loading branch information...
1 parent 66e4547 commit 09750f6fe3b9323e3c8737c420c8d21bef1652f7 @chriso chriso committed Aug 13, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/rest.js
View
@@ -213,14 +213,16 @@ function topLevelRoutes (app, prefix, resource, config) {
//GET /<resource>
routes.index = function (request, response, next) {
- var page = request.query.page || 1
+ var page = parseInt(request.query.page) || 1
, limit = Math.min(config.max_limit, request.query.limit
|| config.default_limit)
, offset = (page - 1) * limit
, locals = {}
, query;
function doQuery(query) {
+ console.log(limit);
+
query.skip(offset).limit(limit).run(function (err, results) {
if (err) {
return next(new Error(err));

0 comments on commit 09750f6

Please sign in to comment.